Boost logo

Boost :

Subject: Re: [boost] [Filesystem V3] Filesystem Version 3 beta 1 availablefor download and comment
From: Jeffrey Bosboom (jbosboom_at_[hidden])
Date: 2010-02-23 00:28:38

On 2/21/2010 8:00 AM, Beman Dawes wrote:
>> One wrinkle that I never was able to decide how to handle was multiple extensions, like ".tar.gz". Some use cases would want ".tar.gz", some would just want ".gz", and a few would even want just ".tar". Does this library provide any direct support for managing chains of extensions like that?
> The design decision for stem() to return just the last extension
> rather than the entire chain allows a user to visit each element in
> the chain. For example,
> path p = "";
> for (; !p.extension().empty(); p = p.stem())
> cout<< p.extension()<< '\n';
> displays:
> .bz2
> .tar
> .baz
> .bar

I can't find this anywhere in the documentation, and it's pretty
important to note -- I wouldn't have considered that for-loop structure,
probably resorting instead to finding the first period and splitting up
the string.

I don't think an iterator is necessary here, although it would have made
the loop construction more obvious. I don't see a pressing need to pass
extensions to functions that expect iterators.

--Jeffrey Bosboom

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