Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-05-05 09:23:10


At 04:14 AM 5/5/2003, Vladimir Prus wrote:

>Beman Dawes wrote:
>
>...
>> * I think the preconditions should be removed. In each case, the
behavior
>> as specified is quite sensible even if ph.leaf().empty(), and may be
>useful
>> in some applications. (Assuming you agree, the assert()'s should be
>> removed, and test cases should be added.)
>
>Let me ponder a little. For 'extension', the idea that empty path has
empty
>extension seems ok. For 'basename' this looks even more resonable.
However,
>for "change_extension", this is not so. If you call
>
> change_extension("", ".txt")
>
>you'll get ".txt" as result, which has no sense at all. But I'm not sure
>the assertion, here, is so big help. So I'll removed precondition here
>as well, but add a bit of rationale.

Good. I agree with your reasoning.

>However, I've a question: if is always true that ph.leaf().empty() ==
>ph.empty.

Yes, that's both intuitively correct and follows from the specification
path()'s return.

> IOW, is it ever possible to have empty element in the sequence of
>strings that compose the path?

No, not in a path which follows the portable grammar. It is a little less
clear for a native path on a system other than POSIX or Windows, but I
don't think we should agonize over that corner case.

Thanks,

--Beman


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