This is untested code, but just to visualize paradigm used by boost file system and what Daniel explained:

 bfs::path p( "." );
 bfs::directory_iterator begin( p ), end;
 for_each( begin, end, boost::bind(&purgeOlder, _1 )  )



Best Regards,
Ovanes



On Mon, Apr 14, 2008 at 10:07 AM, Daniel Krügler <dsp@bdal.de> wrote:
Brad wrote:
> Hi guys and gals,
>
> I'm new to boost and this is my first attempt to use bind (big step LOL).
>
> I'm trying to do this:
>
>     bfs::path p( "." );
>     bfs::directory_iterator dir_iter( p );
>     for_each( dir_iter.begin(), dir_iter.end(), boost::bind(
> &purgeOlder, _1 )  )
>
> but I get:
>
> purgefiles.cpp:53: error: 'class boost::filesystem::directory_iterator'
> has no member named 'begin'
> purgefiles.cpp:53: error: 'class boost::filesystem::directory_iterator'
> has no member named 'end'
>
> It would appear directory_iterator does not have these members which are
> common on the other containers, am I missing something? Is there a way
> to do this using bind?

This has nothing to do with bind. As you say, begin()/end() would
be available for a *container*, but - as the name says -
directory_iterator is just an iterator, not a container. If you follow
the documentation, you will find out, that the default constructed
directory_iterator corresponds to "end" and that there exists one
further c'tor that accepts a path - this is the one you should use
in replacement for begin.
For a better understanding of the idea behind that you should compare
directory_iterator with existing std iterator adaptors, like the insert
iterators or the stream iterators.

HTH & Greetings from Bremen,

Daniel Krügler

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users