Boost::filesystem::path在Linux机器上接受wstring
boost::filesystem::path accepts wstring on linux machine
根据boost文档,char在unix系统上用于boost::filesystem::path
内部值类型。但是在linux上,下面的代码可以编译并正常工作。
const std::wstring &m_blobStore;
boost::filesystem::path dir(m_sharePath.begin(), m_sharePath.end());
cout<<dir.string(); // prints the value stored as wstring.
期望是,如果m_blobStore
是string
而不是wstring
,那么它应该在linux机器上工作。
在文档中的path
构造器部分,您可以找到:
template <class InputIterator> path(InputIterator begin,
InputIterator end, const codecvt_type& cvt=codecvt());
Effects:在pathname中存储[begin,end]或source的内容。如果内容为通用格式,则通用格式为不可接受的操作系统的API,它们被转换为原生格式。[注:对于ISO/IEC 9945和Windows实现,通用格式已经可以作为本机格式接受,所以不需要执行泛型到本机的转换。——注意结束]
备注:如果[begin,end)或source的值类型不是value_type,则由cvt进行转换。
所以它接受wstring
是正确的每个文档,它将在内部转换为value_type
。
请参阅文档的这一部分。
value_type是操作系统用来表示路径名的字符类型的实现定义的typedef。
描述为返回const string、const wstring、const u16string或const u32string的成员函数允许分别返回const string&、const wstring&、const u16string&或const u32string&
相关文章:
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- Ctypes wstring通过引用传递
- 如何在本地机器上运行c++和javascript客户端代码(hackerbank风格)
- 在两台机器之间进行时间戳的最佳c++chrono函数是什么
- 64位机器上的C++内存对齐
- 使用不同的链接器会产生不同的机器代码吗
- 我写了一个C++程序来模拟Enigma机器.我没有得到输出
- 在C++中将变量 wstring 分配给 Char 数组
- 如何将经过训练的机器学习模型保存在python中并将其加载到C++中进行预测?
- 将日语 wstring 转换为 std::string
- 使用 memcpy 将矢量数据复制到 wstring 的正确方法
- C++ 两台不同机器之间通过wifi进行套接字通信
- 使用 ssh 重新连接到远程 Ubuntu 机器后,如何继续使用 gdb 调试 c++ 代码?
- 代码厨师 2019 年 12 月午餐时间愚蠢的机器
- CMake:尝试在 Jenkins 构建机器上运行时出现"Linked Library"错误 (0xc0000135)
- -fshort-wchar 和 std::wstring - 分段错误
- objdump 不显示机器代码,但显示 ASM
- 输出 c++ 窗口 wstring 日志在终端中正确
- 不同机器之间的标准时钟性能差异显著
- Boost::filesystem::path在Linux机器上接受wstring