Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-05-12 16:54:17


"DY, JERRY U (SBCSI)" <jd2419_at_[hidden]> writes:

> In trying to compile the filesystem library, I'm getting an error that
> the compiler cannot find the operator== for the following function:
>
> bool is_empty_directory( const fs::path & dir_path )
> {
> return fs::directory_iterator(dir_path) == end_itr;
> }
>
> aCC-C++-action
> ../../../bin/boost/libs/filesystem/build/libboost_filesystem.a/acc/debug
> /operations_posix_windows.o
> Error 226:
> "../../../libs/filesystem/build/../src/operations_posix_windows.cpp",
> line 176 # No appropriate function found for call of 'operator =='.
>
> class directory_iterator doesn't declare it, neither do ancestors
> iterator_facade and iterator_facade_types. Can't find free function for
> operator==(directory_iterator&, directory_iterator&),
> operator==(iterator_facade&, iterator_facade&),
> operator==(iterator_facade_types&, iterator_facade_types&) or any of its
> variants. Is it using the default compiler-generated operator== in
> directory_iterator?

The compiler is wrong. There is an operator== that takes two
iterator_facade specializations in iterator_facade.hpp, generated by
this line:

  BOOST_ITERATOR_FACADE_RELATION(==, return, equal)

Try preprocessing the source if you need to see it.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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