pmr
pmr

Reputation: 59811

Boost.Iterator Facade with an incomplete Value argument

I'm trying to use boost::iterator_facade with an incomplete Value template argument. This fails, because iterator_facade is trying to check if the type is_pod.

Is this the expected behavior? Can I work around this limitation in some way? I could write a class template that simply proxies foo and provides implicit conversion to it, but I'd rather have a simpler solution.

#include <boost/iterator/iterator_facade.hpp>

class iter
  : public boost::iterator_facade< iter,
                                   iter,
                                   boost::forward_traversal_tag
                                   >
{
private:
  friend class boost::iterator_core_access;

  void increment() {  }

  bool equal(iter const& other) const { return true; }

  iter& dereference() const { return const_cast<iter&>(static_cast<const iter&>(*this)); }
};


int main()
{
  iter f;
  return 0;
}

Upvotes: 4

Views: 409

Answers (1)

Pawel Zubrycki
Pawel Zubrycki

Reputation: 2713

If is_pod a problem can't you just specialize it with iter type?

On ideone - http://ideone.com/1DR8v - it seems to be working that way, even if type in not defined at all and is_pod is specialized with that incomplete type.

Upvotes: 2

Related Questions