Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#3684 closed Bugs (invalid)

tuple not really a synonym for vector?

Reported by: Dave Abrahams Owned by: Joel de Guzman
Milestone: Boost 1.42.0 Component: fusion
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:

Description

I believe the enclosed patch should still allow the zip_iterator test to compile if “tuple is basically a synonym for vector” as claimed by http://www.boost.org/doc/libs/1_41_0/libs/fusion/doc/html/fusion/tuple/class_template_tuple.html

Although, the word “basically” basically gives you permission to make it not a synonym in any ways you choose. You should either drop that word or drop the whole claim. :-)

Attachments (1)

zip_iterator.patch (10.6 KB ) - added by Dave Abrahams 13 years ago.

Download all attachments as: .zip

Change History (9)

by Dave Abrahams, 13 years ago

Attachment: zip_iterator.patch added

comment:1 by Joel de Guzman, 13 years ago

The docs read as: "Currently tuple is basically a synonym for vector, although this may be changed in future releases of fusion. "

That should be understood as "Currently fusion::tuple is basically a synonym for fusion::vector, although this may be changed in future releases of fusion. "

I believe this claim holds. You can use fusion::tuple and fusion::vector interchangeably. The claim does not imply that boost::tuple is a synonym for fusion::vector as your patch requires. I tried your code and the compiler barfs when it gets to the point where it expects *invalid* expressions like Tuple::head_type. If the code adheres to only the API of TR1::tuple and/or fusion::vector, then all is well.

comment:2 by Dave Abrahams, 13 years ago

One of us is very confused. The errors I saw had to do with not being able to convert vector2<int, double const> to tuple<int&, double const&>.

comment:3 by Joel de Guzman, 13 years ago

I am getting zip_iterator.hpp(118) : error C2039: 'head_type' : is not a member of 'boost::fusion::tuple<T0,T1>'. Testing SVN trunk. What am I missing? Should I be testing release branch instead?

comment:4 by anonymous, 13 years ago

I'm getting the same error as Joel with both the trunk and release branches as of revision 60449.

gcc.compile.c++ ..\..\..\bin.v2\libs\iterator\test\zip_iterator_test.test\gcc-mingw-4.4.1\debug\zip_iterator_test.o
In file included from zip_iterator_test.cpp:43:
..\..\../boost/iterator/zip_iterator.hpp: In instantiation of 'boost::detail::tuple_impl_specific::tuple_meta_transform_impl<boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>, boost::detail::iterator_reference<mpl_::arg<1> > >':
..\..\../boost/mpl/eval_if.hpp:38:   instantiated from 'boost::mpl::eval_if<boost::is_same<boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>, boost::tuples::null_type>, boost::mpl::identity<boost::tuples::null_type>, boost::detail::tuple_impl_specific::tuple_meta_transform_impl<boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>, boost::detail::iterator_reference<mpl_::arg<1> > > >'
..\..\../boost/iterator/zip_iterator.hpp:134:   instantiated from 'boost::detail::tuple_impl_specific::tuple_meta_transform<boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>, boost::detail::iterator_reference<mpl_::arg<1> > >'
..\..\../boost/iterator/zip_iterator.hpp:349:   instantiated from 'boost::detail::tuple_of_references<boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> >'
..\..\../boost/iterator/zip_iterator.hpp:415:   instantiated from 'boost::detail::zip_iterator_base<boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> >'
..\..\../boost/iterator/zip_iterator.hpp:458:   instantiated from 'boost::zip_iterator<boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> >'
zip_iterator_test.cpp:113:   instantiated from here
..\..\../boost/iterator/zip_iterator.hpp:124: error: no type named 'head_type' in 'struct boost::fusion::tuple<std::_Rb_tree_const_iterator<int>, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>'

Dave, unless you can provide more details, I'm going to close this.

comment:5 by Steven Watanabe, 13 years ago

The last comment was from me, BTW.

comment:6 by Steven Watanabe, 12 years ago

Resolution: invalid
Status: newclosed

comment:7 by Dave Abrahams, 12 years ago

I think I understood this to mean that boost::tuple was a synonym for fusion::vector. What is required in order to get zip_iterator to work with fusion tuples and boost tuples?

comment:8 by Joel de Guzman, 12 years ago

Well, either just stick to std::tuple interface or if that is too limiting, use fusion::vector. I'll see if I can get a crack at it.

Note: See TracTickets for help on using tickets.