Subject: Re: [boost] [filesystem] windows/posix inconsistencies.
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2012-01-31 08:47:05
> However, consider
> const std::string& ext = iter->path().extension().string();
> This is fine on windows, as a temporary is returned, and its lifetime is
> extended; on linux, extension() returns a temp path object, from where
> we get a reference. I'm not a 100% sure, but I think the C++ standard
> does not guarantee that this path object be kept alive.
* The Standard requires the temporary path to be destroyed at the semicolon.
* Replace string with wstring, and this becomes problematic on Windows.
* Additionally, returning const values like const string/const wstring inhibits move semantics.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk