std::experimental::filesystem::path::root_name

Returns the root name of the path. If the path does not include root name, returns path().

# Declarations

path root_name() const;

(filesystem TS)

# Return value

The root name of the path.

# Example

#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;
 
int main()
{
    std::cout << "Current root name is: " << fs::current_path().root_name() << '\n';
}

# See also