std::experi...::root_path(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸŽ€ std::experi...::root_path(3) πŸŽ€

Okay bestie, you're on the C++ Standard Libary manual page for std::experi...::root_path(3) β€” yes, the filesystem girlies are back, and this one is all about the root path. πŸ’…βœ¨


πŸ¦‹ NAME πŸ¦‹

  • std::experimental::filesystem::path::root_path β€” std::experimental::filesystem::path::root_path

It's literally the same name twice, and honestly? Iconic. 🫢

✨ Synopsis ✨

path root_path() const;  (filesystem TS)

It's giving tiny but mighty: path root_path() const; in the (filesystem TS). 🌸

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

Effectively, returns the following: root_name() / root_directory(). No cap. πŸ’–

🌟 Parameters 🌟

(none) β€” literally no parameters, bestie. Not a single one. πŸ™ˆ

πŸ’– Return value πŸ’–

The root path of the path. That's the whole assignment. πŸŽ€

πŸ”₯ Exceptions πŸ”₯

May throw implementation-defined exceptions. So like, keep that in mind, okay? 😭

πŸ“ Example πŸ“

// Run this code

#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;

int main()
{
    std::cout << "Current root path is: " <<
fs::current_path().root_path() << '\n';
}

Possible output:

Current root path is: "C:\"

It's giving short and sweet, and the possible output is literally Current root path is: "C:\". Slay. πŸ’…

🌈 See also 🌈

  • root_name β€” returns the root-name of the path, if present (public member function)
  • root_directory β€” returns the root directory of the path, if present (public member function)

Two little besties doing related path things. Obsessed. πŸ¦‹

🏷️ Category 🏷️

  • Noindexed pages

Source: http://cppreference.com Β· Version/date: 2024.06.10 Β· Page: std::experi...::root_path(3) β€” mwah, bye bestie! πŸ’‹πŸ’–

πŸ“¦ where this page comes from