Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-03-20 16:35:00


At 12:58 PM 3/20/2002, Peter Dimov wrote:

>> int main( int argc, char * argv[]
>> {
>> initial_directory(); // lock down before calling other functions
>> string dir_path;
>> if ( user provided a relative path )
>> dir_path = compose( initial_directory(), user provided path );
>> else
>> dir_path = user provided path;
>
>IOW a make_absolute() function, if provided, would treat relative paths
as
>relative to the initial_directory(). Yes, I see.
>
>How is this superior to simply providing a getcwd() function and letting
>the user do
>
>int main()
>{
> std::string initial = getcwd();
>// rest unchanged
>}

There would be no difference at all at that point in the code. But if
initial_directory() is called again later by some library routine, it still
will give the correct answer. Eventually initial_directory() might become
part of the standard, and then would be set by the runtime library before
main() runs.

If anyone comes up with a killer argument for get/set cwd, we can include
them. But that hasn't happened so far.

>> >basic_directory_iterator probably doesn't need a destructor.
>>
>> Depends on how the internals are implemented, doesn't it? If the rep
>type
>> is opaque and non-trivial (as in the current imp) then a destructor is
>> needed, for example.
>
>Well, it uses shared_ptr, and its destructor does the right thing for
>incomplete types. :-)

Yes, but in general that is just an implementation detail AFAICS.

--Beman


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