[iterator][msvc-8.0][trunk] iterator_adaptor with incomplete Value

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

on Mon Oct 08 2007, "JOAQUIN LOPEZ MU?Z" <joaquin-AT-tid.es> wrote:
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?
I'm not sure it's achievable. Patches welcomed, though. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

----- Mensaje original ----- De: David Abrahams <dave@boost-consulting.com> Fecha: Lunes, Octubre 15, 2007 11:39 pm Asunto: Re: [boost] [iterator][msvc-8.0][trunk] iterator_adaptor withincomplete Value Para: boost@lists.boost.org
on Mon Oct 08 2007, "JOAQUIN LOPEZ MU?Z" <joaquin-AT-tid.es> wrote:
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?
I'm not sure it's achievable. Patches welcomed, though.
I haven't gauged the full consequences of the following patch, but at least it shuts the compiler up on the test case provided in my prior post. What do you think about it? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

on Mon Oct 15 2007, "JOAQUIN LOPEZ MU?Z" <joaquin-AT-tid.es> wrote:
I haven't gauged the full consequences of the following patch, but at least it shuts the compiler up on the test case provided in my prior post. What do you think about it?
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo Index: iterator_facade.hpp =================================================================== --- iterator_facade.hpp (revision 39907) +++ iterator_facade.hpp (working copy) @@ -381,7 +381,7 @@ > {};
- template <class Iterator, class Value, class Reference> + template <class Iterator, class Value, class Reference,class Difference> struct operator_brackets_result { typedef typename mpl::if_< @@ -649,8 +649,9 @@ >::make(*this->derived()); }
- typename boost::detail::operator_brackets_result<Derived,Value,reference>::type - operator[](difference_type n) const + template<typename Difference> + typename boost::detail::operator_brackets_result<Derived,Value,reference,Difference>::type + operator[](Difference n) const { typedef boost::detail::use_operator_brackets_proxy<Value,Reference> use_proxy;
It itself, it looks OK. I would like to be surer that it solves the problem completely, though, before committing it. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

David Abrahams ha escrito:
on Mon Oct 15 2007, "JOAQUIN LOPEZ MU?Z" <joaquin-AT-tid.es> wrote:
I haven't gauged the full consequences of the following patch, but at least it shuts the compiler up on the test case provided in my prior post. What do you think about it?
[...]
It itself, it looks OK. I would like to be surer that it solves the problem completely, though, before committing it.
Do you want me to do something about this, then? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (3)
-
"JOAQUIN LOPEZ MU?Z"
-
David Abrahams
-
Joaquín Mª López Muñoz