Boost C++ Libraries: Ticket #5301: Boost.Filesystem V3 interface inconsistency https://svn.boost.org/trac10/ticket/5301 <p> I came across the following interface inconsistency in Boost.Filesystem V3 (Boost 1.46.0) in boost::filesystem::path </p> <p> Windows: </p> <p> const std::string string() const std::wstring&amp; wstring() </p> <p> Linux: </p> <p> const std::string&amp; string() const std::wstring wstring() </p> <p> We converted V2 code looking like this (necessary since filename() in V3 returns a path instead of a string): </p> <p> const std::string&amp; filename=path.filename(); </p> <p> The converted V3 code: </p> <p> const std::string&amp; filename=path.filename().string(); </p> <p> Obviously this code crashes in Linux since filename() returns a temporary object and string() returns a reference to one of its members. </p> <p> However this code works in Windows due to the different return types. </p> <p> My question: </p> <p> Wouldn't it make sense for all methods to return a value instead of a reference? </p> <p> It would ease the transition from V2 to V3 and avoid subtle programming errors. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5301 Trac 1.4.3