This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Simplifing tuples
- From: Chris Jefferson <caj at cs dot york dot ac dot uk>
- To: Theodore Papadopoulo <Theodore dot Papadopoulo at sophia dot inria dot fr>
- Cc: Benjamin Kosnik <bkoz at redhat dot com>, pcarlini at suse dot de, libstdc++ at gcc dot gnu dot org
- Date: Mon, 11 Oct 2004 21:30:22 +0100
- Subject: Re: Simplifing tuples
- References: <200410111631.i9BGV9iA031056@mururoa.inria.fr>
Theodore Papadopoulo wrote:
Maybe Chris should post the current ugly error messages and people
should discuss about what information is important and how to provide
optimal/better messages in such cases. With a few such cases, maybe we can
come up with a clearer idea on how to improve the messages and how to
support such a thing (if support is needed).
OK, you asked for it :)
Note that all these error messages can be made screens long by making
the tuples longer and making the error further along...
1) tuple<int,int,int,int,int> x; tuple<int,int,int,int,foo> y; x=y;
I get:
tuples.cpp: In member function `tuple<T0, T1, T2, T3, T4, __NullClass,
__NullClass, __NullClass, __NullClass, __NullClass>& tuple<T0, T1,
T2, T3,
T4, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass>::operator=(const tuple<U0, U1, U2, U3, U4, __NullClass,
__NullClass, __NullClass, __NullClass, __NullClass>&) [with U0 = int,
U1 =
int, U2 = int, U3 = int, U4 = foo, T0 = int, T1 = int, T2 = int, T3 =
int,
T4 = int]':
tuples.cpp:742: instantiated from here
tuples.cpp:269: error: cannot convert `const foo' to `int' in assignment
tuples.cpp: In function `int main()':
tuples.cpp:746: error: no matching function for call to `tuple_value<0,
tuple<int, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass,
__NullClass, __NullClass, __NullClass, __NullClass>
>::get_value(tuple<int,
int, int, int, int, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass>&)'
tuples.cpp:459: error: candidates are: static typename tuple_element<0,
T>::type tuple_value<0, T>::get_value(T&) [with T = tuple<int,
__NullClass,
__NullClass, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass, __NullClass, __NullClass>]
(perhaps we shouldn't list default template parameters?)
Boosts is shown here (note that actually, if you just ignore the bulk
the of the text and read the last line then the problem is clear.. but
the text is a bit of a problem..)
/usr/include/boost/tuple/detail/tuple_basic.hpp: In member function `
boost::tuples::cons<HT, boost::tuples::null_type>&
boost::tuples::cons<HT,
boost::tuples::null_type>::operator=(const boost::tuples::cons<HT2,
boost::tuples::null_type>&) [with HT2 = foo, HT = int]':
/usr/include/boost/tuple/detail/tuple_basic.hpp:301: instantiated from
`boost::tuples::cons<HT, TT>& boost::tuples::cons<HT,
TT>::operator=(const boost::tuples::cons<HT2, TT2>&) [with HT2 = int,
TT2 = boost::tuples::cons<foo, boost::tuples::null_type>, HT = int, TT =
boost::tuples::cons<int, boost::tuples::null_type>]'
/usr/include/boost/tuple/detail/tuple_basic.hpp:301: instantiated from
`boost::tuples::cons<HT, TT>& boost::tuples::cons<HT,
TT>::operator=(const boost::tuples::cons<HT2, TT2>&) [with HT2 = int,
TT2 = boost::tuples::cons<int, boost::tuples::cons<foo,
boost::tuples::null_type> >, HT = int, TT = boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> >]'
/usr/include/boost/tuple/detail/tuple_basic.hpp:301: instantiated from
`boost::tuples::cons<HT, TT>& boost::tuples::cons<HT,
TT>::operator=(const boost::tuples::cons<HT2, TT2>&) [with HT2 = int,
TT2 = boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<foo, boost::tuples::null_type> > >, HT = int, TT =
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > >]'
/usr/include/boost/tuple/detail/tuple_basic.hpp:301: instantiated from
`boost::tuples::cons<HT, TT>& boost::tuples::cons<HT,
TT>::operator=(const boost::tuples::cons<HT2, TT2>&) [with HT2 = int,
TT2 = boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<foo,
boost::tuples::null_type> > > >, HT = int, TT = boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > > >]'
/usr/include/boost/tuple/detail/tuple_basic.hpp:554: instantiated from
`boost::tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>&
boost::tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8,
T9>::operator=(const boost::tuples::cons<HT2, TT2>&) [with U1 = int, U2
= boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<foo,
boost::tuples::null_type> > > >, T0 = int, T1 = int, T2 = int, T3 = int,
T4 = int, T5 = boost::tuples::null_type, T6 = boost::tuples::null_type,
T7 = boost::tuples::null_type, T8 = boost::tuples::null_type, T9 =
boost::tuples::null_type]'
boost.cpp:10: instantiated from here
/usr/include/boost/tuple/detail/tuple_basic.hpp:379: error: cannot convert `
const foo' to `int' in assignment
But note that the middle part of this (the parts refering to
tuple_basic.hpp) are repeated as the tuples get longer...
tuple<int,int,int,int,int> y;
int x=get<6>(y);tuples.cpp: In function `int main()':
tuples.cpp:746: error: no matching function for call to `tuple_value<0,
tuple<int, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass,
__NullClass, __NullClass, __NullClass, __NullClass>
>::get_value(tuple<int,
int, int, int, int, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass>&)'
tuples.cpp:459: error: candidates are: static typename tuple_element<0,
T>::type tuple_value<0, T>::get_value(T&) [with T = tuple<int,
__NullClass,
__NullClass, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass, __NullClass, __NullClass>]
tuples.cpp: At global scope:
tuples.cpp: In instantiation of `tuple_element<6, tuple<int, int, int,
int, int, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass> >':
tuples.cpp:747: instantiated from here
tuples.cpp:542: error: no type named `__type6' in `struct tuple<int,
int, int,
int, int, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass>'
tuples.cpp: In function `int main()':
tuples.cpp:747: error: no matching function for call to `get(tuple<int, int,
int, int, int, __NullClass, __NullClass, __NullClass, __NullClass,
__NullClass>&)'
The error message from my current implementation is less useful here....
However, I shall leave you with boost's reply to this not request.
Chris
/usr/include/boost/tuple/detail/tuple_basic.hpp: In instantiation of
`boost::tuples::element<1, boost::tuples::null_type>':
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<2, boost::tuples::cons<int,
boost::tuples::null_type> >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<3, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<4, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<5, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > > > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<6, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > > > >'
boost.cpp:9: instantiated from here
/usr/include/boost/tuple/detail/tuple_basic.hpp:135: error: no type named `
tail_type' in `struct boost::tuples::null_type'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: error: no type named `
tail_type' in `struct boost::tuples::null_type'
/usr/include/boost/tuple/detail/tuple_basic.hpp: In instantiation of
`boost::tuples::element<2, boost::tuples::cons<int,
boost::tuples::null_type> >':
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<3, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<4, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<5, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > > > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<6, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > > > >'
boost.cpp:9: instantiated from here
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: error: no type
named `type
' in `struct boost::tuples::element<1, boost::tuples::null_type>'
/usr/include/boost/tuple/detail/tuple_basic.hpp: In instantiation of
`boost::tuples::element<3, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > >':
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<4, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<5, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > > > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<6, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > > > >'
boost.cpp:9: instantiated from here
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: error: no type
named `type
' in `struct boost::tuples::element<2, boost::tuples::cons<int,
boost::tuples::null_type> >'
/usr/include/boost/tuple/detail/tuple_basic.hpp: In instantiation of
`boost::tuples::element<4, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > >':
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<5, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > > > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<6, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > > > >'
boost.cpp:9: instantiated from here
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: error: no type
named `type
' in `struct boost::tuples::element<3, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp: In instantiation of
`boost::tuples::element<5, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::null_type> > > > >':
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: instantiated from
`boost::tuples::element<6, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > > > >'
boost.cpp:9: instantiated from here
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: error: no type
named `type
' in `struct boost::tuples::element<4, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type>
> > >'
/usr/include/boost/tuple/detail/tuple_basic.hpp: In instantiation of
`boost::tuples::element<6, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::null_type> > > > > >':
boost.cpp:9: instantiated from here
/usr/include/boost/tuple/detail/tuple_basic.hpp:137: error: no type
named `type
' in `struct boost::tuples::element<5, boost::tuples::cons<int,
boost::tuples::cons<int, boost::tuples::cons<int,
boost::tuples::cons<int,
boost::tuples::null_type> > > > >'
boost.cpp: In function `int main()':
boost.cpp:9: error: no matching function for call to `get(
boost::tuples::tuple<int, int, int, int, int, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type>&)'