
Martin Owens <doctormo@...360...> writes:
Jon Cruz: What say you, std::string or std::ustring for paths?
Lurker here, but the soon-to-be-canonical solution is std::path, which is currently known as boost::path or std::tr2::path if your compiler is new enough.
The only surprise you need to be aware of, if your string bits are stored as utf8 rather than the native narrow type, is that you need to use:
filesystem::detail::utf8_codecvt_facet utf8; path(myUtf8String, utf);
in boost, or
u8path(myUtf8String);
in tr2.
Aside from that, it's quite nice to work with. You can start doing things like:
ifstream fin(settingsPath / "settings.txt");
and it has all sorts of functionality to handle the platform-dependent differences for you.
Might not be worth switching now, since it's not standard yet, but worth keeping in mind.
The C++ standard group is also working on std::experimental::uri, which is interoperable with std::tr2::path, but that one is based on cpp-netlib rather than Boost, and the standardization effort is only about a year old, so you probably don't want to adopt it yet.
Cheers,
-Rick-
Refernces: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3505.html http://www.boost.org/doc/libs/1_55_0/libs/filesystem/doc/index.htm http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3947.html http://cpp-netlib.org/