Boost logo

Boost :

Subject: Re: [boost] boost::filesystem::path frustration
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-01-25 18:54:02


on Fri Jan 25 2013, Eric Niebler <eniebler-AT-boost.org> wrote:

> On 01/25/2013 08:30 AM, Beman Dawes wrote:
>> Not particularly elegant, but this does work:
>>
>> path x("/foo/bar");
>> path y("/foo/baar");
>>
>> auto result = std::mismatch(x.begin(), x.end(), y.begin());
>>
>> path prefix;
>> for (auto itr = x.begin(); itr != result.first; ++itr)
>> prefix /= *itr;
>
> I believe this last bit is just std::accumulate with std::divides<path>.
> Whether that better expresses intent is another matter.

Seriously, no. I have no problem using / for path construction, but
"divides" means division.

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

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