|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-09-17 10:07:53
At 10:26 AM 9/17/2002, Volodya wrote:
>This works nice here, but in a more complex example:
>
> path base("/home/ghost", system_specific);
> path p("a/b/c/d", system_specific);
>
>How do I join base with p?
I'm not sure what you mean by "join". If the result you want is
"/home/ghost/a/b/c/d", then base<<p will do it. If you want
"/home/a/b/c/d", then use base.branch()<<p.
If the result you want is something else, let me know.
Do I need to manually split p in components?
>
> path base("/home/ghost", system_specific);
> path p("/a/b/c/d", system_specific);
>
>Here, even if I manage to split 'p' into components, what will they be?
>I guess, "", "a", "b", "c", "d".
You can use path::begin() and path::end() to get iterators for the
sequence. Iteration would return std::strings "/", "a", "b", "c", "d".
But that is only provided as a fall back to meet unusual needs. I don't
think you should need to do that for join(). But you need to give me
examples of what you expect the join() output to be. Is it just
concatenation or does it drop, merge, or otherwise modify some elements?
>> Note that the library doesn't currently enforce the above approach. You
>> can code create_directory( "bar" ) and it will work fine, although it
is
>> anybody's bet what directory "bar" will end up in; the implementor is
>> only expected to do what is natural for the operating system (which may
>> have no concept of current directory).
>
>Maybe this should be stated explicitly in docs?
Yes, agreed.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk