Re: [Boost-users] [mpl] at_c type compiler error
------------------------------------------------------------
Subject: Boost-users Digest, Vol 1423, Issue 3
Date: Thu, 18 Oct 2007 12:00:06 -0400
Message-ID:
{ return t.get<0>(); }
{ return boost::get<0>(t); }
Hi all -- Just to say I encountered what looks to be
the same problem. Here is the note I left myself:
// can later access the statistics as follows:
//
// std::tr1::tuple
on Fri Oct 19 2007, Robbie Morrison
------------------------------------------------------------ Subject: Boost-users Digest, Vol 1423, Issue 3 Date: Thu, 18 Oct 2007 12:00:06 -0400 Message-ID:
------------------------------------------------------------ Message: 3 Date: Thu, 18 Oct 2007 17:03:25 +0200 From: Vinzenz 'evilissimo' Feenstra Subject: Re: [Boost-users] [mpl] at_c type compiler error To: boost-users@lists.boost.org Message-ID: <471775BD.3010403@web.de> ------------------------------------------------------------
What is all the above supposed to mean?
Chris Weed schrieb:
> { > return t.get<0>(); > }
{ return boost::get<0>(t); }
Does this really have anything to do with mpl::at_c, as the subject implies? It looks like it's all about tuples. Also, is it the Boost implementation of tr1 or some other vendor's? If you have found a bug, please enter a ticket by following the newticket link at http://svn.boost.org/trac/boost. Thanks.
Hi all -- Just to say I encountered what looks to be the same problem. Here is the note I left myself:
// can later access the statistics as follows: // // std::tr1::tuple
stats; // stats = myTs.getStats(); // int count; // count = stats.get<0>(); // member function usage (could be buggy) // count = std::tr1::get<0>(stats); // free function usage Also:
#include
// n-tuples I relealize this is the TR1 version and not the Boost version. Please let me know if some stripped down example code would be useful.
My development environment for the record:
boost : 1.34.1 (via ./configure; make all; make install) gcc : 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) os : Ubuntu 6.10, Linux 2.6.17-12-generic (7.04 is current) hardware : Toshiba Tecra A2 330 laptop (purchased Aug-2004)
cheers Robbie --- Robbie Morrison PhD student -- policy-oriented energy system simulation Institute for Energy Engineering (IET) Technical University of Berlin (TU-Berlin), Germany [from IMAP client]
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Chris Weed schrieb:
>> { >> return t.get<0>(); >> }
{ return boost::get<0>(t); }
Does this really have anything to do with mpl::at_c, as the subject implies? It looks like it's all about tuples. Also, is it the Boost implementation of tr1 or some other vendor's? If you have found a bug, please enter a ticket by following the newticket link at http://svn.boost.org/trac/boost. Thanks.
I was mistaken about what was generating the compile error. I think it had to do with there not being a get member function in boost::tuple<int> This confused me since I thought I had used that in the past, and the doc's suggested it worked. Chris
Chris Weed wrote:
{ return t.get<0>(); }
Change that to: { return t.template get<0>(); } Chris Weed wrote:
I was mistaken about what was generating the compile error. I think it had to do with there not being a get member function in boost::tuple<int> This confused me since I thought I had used that in the past, and the doc's suggested it worked. Chris
Actually, there is a get member. The problem was that the compiler didn't know the type of t when compiling the function (because t is a template dependent name), so you need to tell it that 'get' is a template method. Because it didn't know that, it assumed the angle brackets were actually 'less than' and 'greater than' symbols, leading to the confusing error messages. Daniel
On 10/20/07, Daniel James
Chris Weed wrote:
{ return t.get<0>(); }
Change that to:
{ return t.template get<0>(); }
Chris Weed wrote:
I was mistaken about what was generating the compile error. I think it had to do with there not being a get member function in boost::tuple<int> This confused me since I thought I had used that in the past, and the doc's suggested it worked. Chris
Actually, there is a get member. The problem was that the compiler didn't know the type of t when compiling the function (because t is a template dependent name), so you need to tell it that 'get' is a template method. Because it didn't know that, it assumed the angle brackets were actually 'less than' and 'greater than' symbols, leading to the confusing error messages.
Thanks for the explanation. Now I see the problem. Chris
David Abrahams schrieb: -----------------------------------------------------------
What is all the above supposed to mean?
It's about that there's no boost::tuple method named get as shown in the current documentation at http://boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements I have already asked for clearing up that issue in the documentation at the [boost-docs] list. I hope that this will be answered. Regards, Vinzenz Feenstra
participants (5)
-
Chris Weed
-
Daniel James
-
David Abrahams
-
Robbie Morrison
-
Vinzenz 'evilissimo' Feenstra