Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-08-15 13:33:42


At 01:12 PM 8/15/2002, Vladimir Prus wrote:
>Thomas Witt wrote:
>> On Thursday 15 August 2002 17:27, Vladimir Prus wrote:
>> > Hi,
>> > I'd like to append a suffix to a path using the filesystem library,
so
>> > that
>> >
>> > directory/path.asm
>> >
>> > would become
>> >
>> > directory/path.asm.cpp
>> >
>> > Yet I see no easy way. Is this use case worth supporting?
>>
>> What about
>>
>> (untested)
>>
>> fs::path path_with_suffix(path.branch() << path.leaf() + ".cpp");
>
>This works, but is rather verbose, in my opinion.

Only alternative I'm aware of is to add operations to class fs::path that
take a string. But that will make the interface confusing, and more
error-prone. Is it a path or is it a string?

If you do the operation a lot, would it be a problem to turn Thomas' little
snippet into an function for your project?

--Beman


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