Hi, I can't figure out why the following code generates a compile error with gcc 3.4: #include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/tuple/tuple.hpp> template<typename E,typename T> typename boost::tuples::element<boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); } int main() { typedef boost::mpl::vector_c<int,0,1> elements; boost::tuple<int> t(1); foo(elements(),t); } main.cpp: In function `typename boost::tuples::element< boost::mpl::at_c<E,0l>::#`typename_type' not supported by pp_cxx_unqualified_id#::value, T>::type foo(E, T)': main.cpp:10: error: expected primary-expression before ')' token main.cpp: In function `typename boost::tuples::element< boost::mpl::at_c<E,0l>::#`typename_type' not supported by pp_cxx_unqualified_id#::value, T>::type foo(E, T) [with E = boost::mpl::vector_c<int, 0l, 1l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l, 2147483647l>, T = boost::tuples::tuple<int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>]': main.cpp:17: instantiated from here main.cpp:10: error: invalid use of member (did you forget the `&' ?)
Chris Weed schrieb:
Hi, I can't figure out why the following code generates a compile error with gcc 3.4:
#include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/tuple/tuple.hpp>
template<typename E,typename T> typename boost::tuples::element<boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); }
int main() { typedef boost::mpl::vector_c<int,0,1> elements; boost::tuple<int> t(1); foo(elements(),t); }
Hi, shouldn't it be: template<typename E,typename T> typename boost::tuples::element<typename boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); } Regards, Vinzenz
On 10/18/07, Vinzenz 'evilissimo' Feenstra <evilissimo@web.de> wrote:
Chris Weed schrieb:
Hi, I can't figure out why the following code generates a compile error with gcc 3.4:
#include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/tuple/tuple.hpp>
template<typename E,typename T> typename boost::tuples::element<boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); }
int main() { typedef boost::mpl::vector_c<int,0,1> elements; boost::tuple<int> t(1); foo(elements(),t); }
Hi,
shouldn't it be:
template<typename E,typename T> typename boost::tuples::element<typename boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); }
Regards, Vinzenz
That doesn't work either. Chris
Vinzenz 'evilissimo' Feenstra schrieb:
Chris Weed schrieb:
Hi, I can't figure out why the following code generates a compile error with gcc 3.4: Hi,
shouldn't it be:
template<typename E,typename T> typename boost::tuples::element<typename boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); }
Regards, Vinzenz Nevermind this wasn't the problem. Here's a working one ;)
#include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/tuple/tuple.hpp> template<typename E,typename T> typename boost::tuples::element< boost::mpl::at_c<E,0>::type::value , T >::type foo(E e, T t) { return boost::get<0>(t); } int main() { typedef boost::mpl::vector_c<int,0,1> elements; boost::tuple<int> t(1); foo(elements(),t); }
On 10/18/07, Vinzenz 'evilissimo' Feenstra <evilissimo@web.de> wrote:
Vinzenz 'evilissimo' Feenstra schrieb:
Chris Weed schrieb:
Hi, I can't figure out why the following code generates a compile error with gcc 3.4: Hi,
shouldn't it be:
template<typename E,typename T> typename boost::tuples::element<typename boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); }
Regards, Vinzenz Nevermind this wasn't the problem. Here's a working one ;)
#include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/tuple/tuple.hpp>
template<typename E,typename T> typename boost::tuples::element< boost::mpl::at_c<E,0>::type::value , T >::type foo(E e, T t) { return boost::get<0>(t); }
int main() { typedef boost::mpl::vector_c<int,0,1> elements; boost::tuple<int> t(1); foo(elements(),t); }
That fixes it, but I don't see why, or what this change had to do with the error message. Thanks, Chris
Chris Weed schrieb:
On 10/18/07, Vinzenz 'evilissimo' Feenstra <evilissimo@web.de> wrote:
Vinzenz 'evilissimo' Feenstra schrieb:
Chris Weed schrieb:
Hi, I can't figure out why the following code generates a compile error with gcc 3.4: Hi,
shouldn't it be:
template<typename E,typename T> typename boost::tuples::element<typename boost::mpl::at_c<E,0>::type::value,T>::type foo(E e,T t) { return t.get<0>(); }
Regards, Vinzenz Nevermind this wasn't the problem. Here's a working one ;)
#include <boost/mpl/vector_c.hpp> #include <boost/mpl/at.hpp> #include <boost/tuple/tuple.hpp>
template<typename E,typename T> typename boost::tuples::element< boost::mpl::at_c<E,0>::type::value , T >::type foo(E e, T t) { return boost::get<0>(t); }
int main() { typedef boost::mpl::vector_c<int,0,1> elements; boost::tuple<int> t(1); foo(elements(),t); }
That fixes it, but I don't see why, or what this change had to do with the error message. Thanks, Chris
Look at this error message: "main.cpp:10: error: invalid use of member (did you forget the `&' ?)" the rest just describes where it happened. I don't know why but there's no method get<int>() in tuple anymore or if there was one. I was confused by this as well. then I had a look into the 1.34.1 sources and wasn't abled to find a member get<int>() So I changed the code to use the external one and it worked. Regards, Vinzenz
participants (2)
-
Chris Weed
-
Vinzenz 'evilissimo' Feenstra