Boost logo

Boost :

From: Rainer Deyke (rainerd_at_[hidden])
Date: 2003-08-21 17:27:33


David Abrahams wrote:
> A single component of a path is still a path, and it
> shouldn't devolve into a string.

I disagree. While a path with just one component can exist, a single path
component is no more a path than an element in an array of integers is
itself an array of integers. A single component of a path is a name, and
therefore naturally represented by 'std::string'.

However, I would still prefer that 'path::leaf' returns a path instead of a
string. My reasoning is practical rather than ideological. If 'p' is a
native path, then 'p.leaf()' may contain any character that is supported by
the native file system, which may include slashes. When 'p.leaf()' is then
converted back into a 'filesystem::path', the resulting path will have
different sematics than intended. This strikes me as very dangerous.

-- 
Rainer Deyke - rainerd_at_[hidden] - http://eldwood.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk