Boost logo

Boost :

Subject: Re: [boost] FW: [filesystem] : basic_path : Feature request
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-02-07 18:17:39


Andrey Semashev wrote:
> Emil Dotchevski wrote:
>
>>> const boost::filesystem::path path("dir1/./dir2/./dir3");
>>> rob_path rpath;
>>> std::remove_copy(path.begin(), path.end(), std::back_inserter(rpath),
>>> ".");
>>
>> Arguably the problem here isn't with basic_path, but with
>> std::back_inserter, which insists on push_back being a member
>> function. You could write your own path_inserter or something.
>
> Can't we use lambda for this?
>
> path rpath;
> std::remove_copy(path.begin(), path.end(), var(rpath) /= _1, ".");

Oh, I meant something like this:

   for_each(path.begin(), path.end(), if_(_1 != ".") [var(rpath) /= _1]);


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