Boost logo

Boost :

Subject: [boost] [filesystem][lexical_cast] Lexical cast of filenames containing spaces
From: Daniel James (dnljms_at_[hidden])
Date: 2010-08-14 06:20:38


An issue has come up in program options. With filesystem v3, this throws:

    lexical_cast<boost::filesystem::path>("file name")

The problem is that filesystem v3's stream extractor treats spaces as
separators (which is the right thing to do IMO), so it only extracts
"file", which causes lexical cast to throw an exception - because the
whole string hasn't been extracted.

Would it be possible to create a special case in lexical_cast to deal
with this? How does it deal with this problem for strings?


Boost list run by bdawes at, gregod at, cpdaniel at, john at