Boost logo

Boost :

From: DY, JERRY U (SBCSI) (jd2419_at_[hidden])
Date: 2004-05-14 11:26:52


I'm learning so much reading at the boost code, which is one of the
reasons why I'm getting so excited. Please bear with my questions.

The compiler appears to be having a problem with matching this
operator== due to the return type, it can't find
enable_if_interoperable<...>::type. Here's how aC++ expanded the macro
BOOST_ITERATOR_FACADE_RELATION from your previous e-mail.

template < class Derived1, class V1, class TC1, class R1, class D1 ,
class Derived2, class V2, class TC2, class R2, class D2 > inline
typename detail::enable_if_interoperable< Derived1, Derived2 , typename
mpl::apply2<detail::always_bool2,Derived1,Derived2>::type >::type
operator ==( iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs ,
iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs) { typedef
::boost::static_assert_test< sizeof(::boost::STATIC_ASSERTION_FAILURE<
(bool)( ( is_interoperable< Derived1, Derived2 >::value ) ) >)>
boost_static_assert_typedef_622; return iterator_core_access::equal(
static_cast<Derived1 const&>(lhs) , static_cast<Derived2 const&>(rhs) ,
is_convertible<Derived2,Derived1>() ); }

enable_if_interoperable is declared as follows. It's empty, and since it
inherits privately from enable_if, none of enable_if's members would be
visible. Now where is the struct member "type"???

template <class Facade1, class Facade2, class Return >
 struct enable_if_interoperable:
   ::boost::iterators::enable_if<
     mpl::or_< is_convertible<Facade1, Facade2> ,
is_convertible<Facade2, Facade1> >, Return >
 {
 };

Thanks!

-Jerry

-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of David Abrahams
Sent: Wednesday, May 12, 2004 2:54 PM
To: boost_at_[hidden]
Subject: [boost] Re: Finding
operator==(directory_iterator&,directory_iterator&)

"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
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost

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