Namespaces
Variants
Views
Actions

std::experimental::filesystem::path

From cppreference.com
< cpp‎ | experimental‎ | fs
Defined in header <experimental/filesystem>
class path;
(filesystem TS)

Objects of type path represent a path. Only syntactic aspects of paths are handled: the pathname may represent a non-existing path or even one that is not allowed on the current operating or file system.

The path can be traversed element-wise via iterators returned by the begin() and end() functions.

Calling any non-const member function of a path invalidates all iterators referring to elements of that object.

The forward traversal is done in the following order:

  • The root name element, if any
  • The root directory element, if any. The element is presented in generic format, thus lexicographical comparisons work correctly.
  • Each successive filename element.
  • . if one or mare trailing non-root / characters are present.

Contents

[edit] Member types

Type Definition
value_type todo
string_type std::basic_string<value_type>
iterator a constant BidirectionalIterator with a value_type of path
const_iterator todo

[edit] Member constants

constexpr value_type preferred_separator
[static]
todo
(public static member constant)

[edit] Member functions

constructs a path
(public member function) [edit]
destroys a path object
(public member function) [edit]
assigns another path
(public member function) [edit]
assigns contents
(public member function) [edit]
Concatenation
appends elements to the path
(public member function) [edit]
concatenates two paths
(public member function) [edit]
Modifiers
erases the contents
(public member function) [edit]
converts directory separators to preferred directory separator
(public member function) [edit]
removes filename path component
(public member function) [edit]
replaces the last path component with another path
(public member function) [edit]
replaces the extension
(public member function) [edit]
swaps two paths
(public member function) [edit]
Format observers
returns the native version of the path
(public member function) [edit]
returns the native version of the path
(public member function) [edit]
returns the path in native pathname format converted to a string
(public member function) [edit]
returns the path in generic pathname format converted to a string
(public member function) [edit]
Compare
compares the lexical representations of two paths lexicographically
(public member function) [edit]
Decomposition
returns the root-name of the path, if present
(public member function) [edit]
returns the root directory of the path, if present
(public member function) [edit]
returns the root path of the path, if present
(public member function) [edit]
returns path relative to the root path
(public member function) [edit]
returns the path of the parent path
(public member function) [edit]
returns the filename path component
(public member function) [edit]
returns the stem path component
(public member function) [edit]
returns the file extension path component
(public member function) [edit]
Queries
checks if the path is empty
(public member function) [edit]
checks if the corresponding path element is not empty
(public member function) [edit]
checks if root_path() uniquely identifies file system location
(public member function) [edit]
Iterators
returns an iterator to the beginning of element list
(public member function) [edit]
returns an iterator to the end of element list
(public member function) [edit]

[edit] Non-member functions

swaps two paths
(function) [edit]
lexicographically compares two paths
(function) [edit]
concatenates two paths
(function) [edit]
performs stream input and output on a path
(function) [edit]
creates a path from a UTF-8 encoded source
(function) [edit]