GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::filesystem::path::begin,std::filesystem::path::end(3) C++ Standard Libary std::filesystem::path::begin,std::filesystem::path::end(3)

std::filesystem::path::begin,std::filesystem::path::end - std::filesystem::path::begin,std::filesystem::path::end


iterator begin() const; (1) (since C++17)
iterator end() const; (2) (since C++17)


1) Returns an iterator to the first element of the path. If the path is empty, the
returned iterator is equal to end().
2) Returns an iterator one past the last element of the path. Dereferencing this
iterator is undefined behavior.


The sequence denoted by this pair of iterators consists of the following:


1. root-name (if any)
2. root-directory (if any)
3. sequence of file-names, omitting any directory separators
4. If there is a directory separator after the last file-name in the path, the last
element before the end iterator is an empty element.


(none)


1) Iterator to the first element of the path.
2) Iterator one past the end of the path


May throw implementation-defined exceptions.

// Run this code


#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
const fs::path p =
# ifdef _WIN32
"C:\\users\\abcdef\\AppData\\Local\\Temp\\";
# else
"/home/user/.config/Cppcheck/Cppcheck-GUI.conf";
# endif
std::cout << "Examining the path " << p << " through iterators gives\n";
for (auto it = p.begin(); it != p.end(); ++it)
std::cout << *it << " │ ";
std::cout << '\n';
}


--- Windows ---
Examining the path "C:\users\abcdef\AppData\Local\Temp\" through iterators gives
"C:" │ "/" │ "users" │ "abcdef" │ "AppData" │ "Local" │ "Temp" │ "" │


--- UNIX ---
Examining the path "/home/user/.config/Cppcheck/Cppcheck-GUI.conf" through iterators gives
"/" │ "home" │ "user" │ ".config" │ "Cppcheck" │ "Cppcheck-GUI.conf" │

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.