Boost logo

Boost :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2004-07-28 15:21:31


I'm now getting into using the filesystem library. Of course the first thing
I've run into is the need to generate lexically relative paths. Having the
luxury of being able to discount links, I have a working solution, atleast
for windows. Some issues that arose are related to a path as a sequence
container. While not show stoppers, the lack of some sequence container
member functions - such as size(), assign(itr,itr) - required that existing
templated classes be refactored to allow use of path as a template argument.
Additionally lacking is a const_iterator type.

size() is used to determine the 'shorter' of two paths whose path::iterator
are passed to std::mismatch as the controlling (beg,end] arguments. The pair
of iterators returned by std::mismatch are used to populate the common,
first_remainder and second_remainder paths. If there is interest in this
code I can post it.

Any thoughts on providing additional sequence container member functions and
typedefs in a post 1.32 release?

Also any plans on incorporating Richard Johnson's globiter facilities? It
would be nice to have a filtered_directory_iterator in any case. Something
like:

filtered_directory_iterator
( const fs::path&
, boost::function1<bool,const std::string&>
)

as a convenience class based on the boost::filter_iterator. Then I could:

   std::for_each
  ( filtered_directory_iterator( aPath, bind( extension, _1 ) == ".hpp" )
  , filtered_directory_iterator()
  , SomeFnc
  );

Then perhaps 'globbing' would be better supported as an additional regex
syntax_option_type? This would keep filesystem from depending on regex.

Jeff F


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