Hi, I am implementing a lazy container/iterator that represents the results of certain iterative algorithm. I have a class (call it solver) that should look like an interator. First I was using boost.operators to make it look like a pointer but then I found boost.Iterator. Because of the nature of the algorithm it can be only traversed forward. I am using it in this way: class solver : //public boost::dereferenceable<solver, result const*>, //replaced with boost::iterator public boost::iterator_facade<solver, result const, boost::forward_traversal_tag, result const /*noref*/ >{ ... result dereference() const{ //was result operator*() const ... } void increment() {...} //was operator++ } note that tipically the last argument is intended to be a reference but in this case, since there in no underlying data the return can't be a reference but a new element generated by the algorithm. Question: is this the intended use of boost::iterator_facade is there an alternative base class for lazy operators? Thank you, Alfredo
participants (1)
-
alfC