Subject: Re: [boost] [1.44] [filesystem] operator +
From: Lars Viklund (zao_at_[hidden])
Date: 2010-08-24 07:05:03
On Tue, Aug 24, 2010 at 10:58:23AM +0200, Jochen Wilhelmy wrote:
>> > for boost::filesystem::path I would suggest an operator + that works
>> > the following
>> > fs::path("foo") + "bar" -> "foobar"
>> > fs::path("foo") + "/bar" -> "foo/bar"
>> > fs::path("foo") / "bar" -> "foo/bar"
> >What's the situation in which you'd like to use that operator?
> Sometimes I have file formats that have two parts, e.g. a description
> xml file
> and a data file. then I'd like to do name + ".xml" and name + ".dat" if
> name is
> a fs::path
Note that Boost.Filesystem contains functions to retrieve and modify
In my opinion, introducing such a free + operator would be quite bad, as
it would encourage use of it to glue on path segments in ways that may
violate the format of paths for a platform, as in your example of an
unconditional +"/bar", which would be horribly wrong for any platform
that didn't use / as separator.
-- Lars Viklund | zao_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk