Boost logo

Boost Users :

Subject: [Boost-users] iterator_facade with incomplete type as Value argument
From: Philipp Moeller (philipp.moeller_at_[hidden])
Date: 2012-02-29 08:07:57

I've tried writing an iterator with iterator_facade that returns itself
as the result of dereference, but the Value template argument requires a
complete type because it tries to make a difference between returning by
value or reference if Value is_pod (as far as I understand).

#include <boost/iterator/iterator_facade.hpp>

class iter
  : public boost::iterator_facade< iter,
                                   boost::forward_traversal_tag >
  void fancy_non_iterator_member();
  friend class boost::iterator_core_access;

  void increment() { }

  bool equal(iter const& other) const { return true; }
  iter& dereference() const { return const_cast<Derived&>(static_cast<const Derived&>(*this)); }

Is this the intended behavior of iterator_facade? Is there some
workaround? Would such an iterator actually be conforming?

Philipp Moeller

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at