std::u32string generic_u32string() const;
概要
UTF-32エンコードで、環境非依存パスフォーマットのパス文字列を取得する。
戻り値
*this
が保持するシステムの環境非依存パスフォーマットを持つパスを、UTF-32エンコードで返す。
例
POSIXベースシステムでの例
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
fs::path p = "/usr/bin/clang";
const std::u32string s = p.generic_u32string();
}
出力
Windowsでの例
#include <cassert>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
fs::path p = "foo\\bar";
const std::u32string s = p.generic_u32string();
assert(s == U"foo/bar");
}
出力
バージョン
言語
- C++17
処理系
- Clang:
- GCC: 8.1 ✅
- Visual C++: 2017 Update 7 ✅