This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 05/08/14 14:37 +0100, Jonathan Wakely wrote:
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();
Here's another patch, to be applied on top of yesterday's, although I think I'm going to rework the whole _Dir_stack implementation to try and simplify it to be just std::stack<_Dir>.
Attachment:
filesystem-2.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |