std::experi...ve_filename(3)

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

🌸 NAME 🌸

okay bestie, welcome to the C++ Standard Libary manual page for std::experi...ve_filename(3) πŸ’…. this page is about std::experimental::filesystem::path::remove_filename - std::experimental::filesystem::path::remove_filename. yes, it says it twice, and we respect the lore πŸ‘‘.

✨ Synopsis ✨

path& remove_filename() (1) (filesystem TS)

bestie, this one removes a single filename component. that's the whole job. iconic ✨.

⚠️ the behavior is undefined if the path has no filename component β€” like, has_filename returns false β€” so pls don't test fate 😭.

πŸŽ€ Parameters πŸŽ€

  • (none) β€” literally no parameters, zero, nada, the void 🫢.

πŸ’– Return value πŸ’–

  • *this β€” it gives you back *this, periodt.

πŸ”₯ Exceptions πŸ”₯

  • May throw implementation-defined exceptions β€” implementation gets to decide, iykyk πŸ’€.

🌈 Example 🌈

// Run this code

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

int main()
{
    std::cout << fs::path("/foo").remove_filename() << '\n'
              << fs::path("/").remove_filename() << '\n';
}

πŸ’¬ Output πŸ’¬

"/"
""

πŸ¦‹ See also πŸ¦‹

  • filename β€” returns the filename path component (public member function)
  • replace_filename β€” replaces the last path component with another path (public member function)
  • has_filename β€” checks if the corresponding path element is not empty (public member function)

🏷️ Category 🏷️

  • Noindexed pages

made with love from source http://cppreference.com ✨ date/version 2024.06.10 ✨ page std::experi...ve_filename(3) β€” mwah, bye bestie πŸ’‹βœ¨

πŸ“¦ where this page comes from