WIP: Implement Filesystem TS

Jonathan Wakely jwakely@redhat.com
Tue Aug 5 13:37:00 GMT 2014


On 05/08/14 09:24 -0400, Ed Smith-Rowland wrote:
>On 08/04/2014 01:11 PM, Jonathan Wakely wrote:
>>* directory_iterator holds a shared_ptr<_Dir> where _Dir is a pimpl
>> class containing a DIR* returned by opendir(), a path object
>> containing the path the dir was opened with, and a directory_entry
>> object that gets returned by dereferencing the iterator. It also
>> contained a file_type enumeration, which gets used on GNU and BSD
>> platforms where the dirent struct contains the file type, which
>> means no stat() system call is needed to find out whether the
>> current entry is a directory and should be recursed into.
>Why not unique_ptr?

Copies of a directory_iterator should refer to the same underlying
DIR, like istream_iterator.

>>* recursive_directory_iterator holds a shared_ptr to a
>> stack<pair<_Dir, directory_iterator>> representing each directory
>> recursed into and the position within that directory. The
>> shared_ptr<_Dir>s belong to the directory_iterator objects in the
>> stack alias the shared_ptr held by the parent
>> recursive_directory_iterator, so the reference counts are shared by
>> the whole stack.
>>
>
>Tidbit: Explicit return bool in create_directories (ec version)? I'm 
>not sure when true should be returned though.

Yep, already fixed in my tree to do:

    return missing.empty();



More information about the Libstdc++ mailing list