From: Matthew Henderson (M.J.Henderson_at_[hidden])
Date: 2006-01-17 07:02:48


I am involved with the development of a generic C++ library for SAT. As part of
this project I have been trying to create some tools for refactoring C++ source
code and have been using the boost::filesystem library.

It seems to us that boost::filesystem::path should be a model of a standard
container and/or of boost forward range. This is a natural requirement, and
should be easy to fulfil.

As things stand we have to provide the following fix ourselves:

 namespace boost {

  template <>
   struct range_const_iterator<boost::filesystem::path> {
     typedef boost::filesystem::path::iterator type;
  };
  template <>
   struct range_const_iterator<boost::filesystem::path> {
     typedef boost::filesystem::path::iterator type;
  };
  template <>
   struct range_size<boost::filesystem::path> {
     typedef boost::filesystem::path::iterator::difference_type type;
  };

   namespace filesystem {
     inline boost::range_size<boost::filesystem::path>::type boost_range
               _size(const boost::filesystem::path& p) {
       return std::distance(p.begin(),p.end());
  }

 }

It seems that boost::filesystem::path should offer some complete functionality
in order to become a model either of a standard container or of a boost range.

Incidentally, are there any tools for refactoring C++ code within the boost
library or any plans in the future to include such tools?

Matthew Henderson