Boost logo

Boost :

From: Israel Fdez. Cabrera (israel_at_[hidden])
Date: 2004-12-01 16:02:37


Hi all, I had a boost::iterator_facade derived iterator implemented as
follow:

class ole_directory_iterator
    : public boost::iterator_facade< POLE::ole_directory_iterator,
                                     POLE::path,
                                     boost::forward_traversal_tag>
{
public://Interface
    enum { Ok = 0, NotOk };

    bool good()
    {
        return (this->m_result == Ok);
    }
    //Constructors
    ole_directory_iterator() : m_storage(0)
    {
        this->m_dirlist.clear();
        this->m_current = -1;
        this->m_result = Ok;
    }

    ole_directory_iterator(const std::string& a_filename);

    //Destructor
    ~ole_directory_iterator()
    {
        m_dirlist.clear();
    }

private://Implementation
    friend class boost::iterator_core_access;

    void Init();

    void increment()
    {
        if ((this->m_current + 1) >= this->m_dirlist.size())
        {
            this->m_current = -1;
            return;
        }
        ++this->m_current;
    }

    bool equal(const ole_directory_iterator& a_iter) const
    {
        if ((a_iter.m_current == -1) &&
            (this->m_current == a_iter.m_current) &&
            (a_iter.m_storage == 0))
        {
            return true;
        }
        return ((this->m_current == a_iter.m_current) &&
(this->m_storage == a_iter.m_storage));
    }

    POLE::path& dereference() const
    {
        if (this->m_current != -1)
        {
            POLE::path& _path =
(POLE::path&)this->m_dirlist[this->m_current];
            return _path;
        }
        return POLE::path(0, "");
    }

private://Data Members
        short m_result;
        std::vector<POLE::path> m_dirlist;
        long m_current;
        Storage* m_storage;
};//ole_directory_iterator

when I write the following code:

POLE::ole_directory_iterator _it(argv[1]);
    POLE::ole_directory_iterator _endIt();
    for (; _it != _endIt; ++_it)
    {
        POLE::path _path = *_it;
    }

I get the following error with MSVC 7.1:

c:\...\pole++.cpp(20): error C2784:
'detail::enable_if_interoperable<Derived1,Derived2,mpl::apply2<boost::detail::always_bool2,Derived1,Derived2>::type>::type
boost::operator !=(const boost::iterator_facade<Derived1,V1,TC1,R1,D1>
&,const boost::iterator_facade<Derived2,V2,TC2,R2,D2> &)' : could not
deduce template argument for 'const
boost::iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference>
&' from 'POLE::ole_directory_iterator'
        
c:\Boost\include\boost-1_32\boost\iterator\iterator_facade.hpp(837) :
see declaration of 'boost::operator`!=''

I'm modifying some one else library, but I get the last version from the
author and added the modifications to the new sources, this code works
with the last library sources but not with the new one. I check the
sources more than once and there are no differences. I'll be glad if
some one give me a hint.

best regards and thanks in advance
Israel


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