最終更新日時(UTC):
が更新

履歴 編集

function
<filesystem>

std::filesystem::path::generic_u32string(C++17)

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

処理系