Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-10-08 19:22:37


Seems like in MSVC++ 8.0 boost::iterator_adaptor doesn't
work when the associated Value type is incomplete. For
instance, the following program:

  #include <boost/iterator/iterator_adaptor.hpp>

  template<typename T>
  struct my_iterator:
    boost::iterator_adaptor<my_iterator<T>,T*>
  {
  };

  struct foo
  {
    my_iterator<foo> it;
  };

  int main(){}

results in:

  ...\boost\type_traits\is_pod.hpp(34) : error C2139: 'foo' :
  an undefined class is not allowed as an argument to compiler
  intrinsic type trait '__is_pod'
      ...\sandbox.cpp(10) : see declaration of 'foo'
      ...\type_traits\is_pod.hpp(128) : see reference to class template
      instantiation 'boost::detail::is_pod_impl<T>' being compiled
  [...]
      ...\boost\iterator\iterator_facade.hpp(652) : see reference to
      class templateinstantiation
      'boost::detail::operator_brackets_result<Iterator,Value,Reference
>'
      being compiled
      with
      [
          Iterator=my_iterator<foo>,
          Value=foo,
          Reference=foo &
      ]
  [...]

while the following variation using a custom "adaptor" works
just fine:

  template<typename Derived,typename Base>
  struct my_iterator_adaptor
  {
    Base b;
  };

  template<typename T>
  struct my_iterator:
    my_iterator_adaptor<my_iterator<T>,T*>
  {
  };

  struct foo
  {
    my_iterator<foo> it;
  };

  int main(){}

IMHO, boost::iterator_adaptor should be compilable with
incomplete Value just as the canonical Value* does.
Any possibility that this can be addressed in MSVC++ 8.0?

Thank you,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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