[fusion][mpl] Get type from fusion sequence using mpl::at_c
Hi,
I am trying to get the type of the first element in a fusion vector
using mpl::at_c. This seems simple enough.
// Here is the code
#include
-----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Chris Weed Hi, I am trying to get the type of the first element in a fusion vector using mpl::at_c. This seems simple enough. ---- I'm a noob to fusion but do you want fusion::result_of::at_c instead?
I tried this, but it seems to be the result of the at_c function which
is a reference. I would like to get the type of the element. I suppose
I could use a meta-function to strip off the &, but it seems like the
mpl version of at_c should do what I want.
Chris
On 1/18/07, Sohail Somani
-----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Chris Weed
Hi, I am trying to get the type of the first element in a fusion vector using mpl::at_c. This seems simple enough.
----
I'm a noob to fusion but do you want fusion::result_of::at_c instead? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
All the at functions would return you a reference, not a copy anyway. So they are doing the right thing. Stripping the reference is the right thing to do.
-----Original Message-----
From: boost-users-bounces@lists.boost.org on behalf of Chris Weed
Sent: Sat 1/20/2007 9:31 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [fusion][mpl] Get type from fusion sequenceusingmpl::at_c
I tried this, but it seems to be the result of the at_c function which
is a reference. I would like to get the type of the element. I suppose
I could use a meta-function to strip off the &, but it seems like the
mpl version of at_c should do what I want.
Chris
On 1/18/07, Sohail Somani
-----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Chris Weed
Hi, I am trying to get the type of the first element in a fusion vector using mpl::at_c. This seems simple enough.
----
I'm a noob to fusion but do you want fusion::result_of::at_c instead? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
It appears another option is as follows:
result_of::value_of
All the at functions would return you a reference, not a copy anyway. So they are doing the right thing. Stripping the reference is the right thing to do.
-----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Chris Weed Sent: Sat 1/20/2007 9:31 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [fusion][mpl] Get type from fusion sequenceusingmpl::at_c
I tried this, but it seems to be the result of the at_c function which is a reference. I would like to get the type of the element. I suppose I could use a meta-function to strip off the &, but it seems like the mpl version of at_c should do what I want. Chris
On 1/18/07, Sohail Somani
wrote: -----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Chris Weed
Hi, I am trying to get the type of the first element in a fusion vector using mpl::at_c. This seems simple enough.
----
I'm a noob to fusion but do you want fusion::result_of::at_c instead? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Chris Weed wrote:
I tried this, but it seems to be the result of the at_c function which is a reference. I would like to get the type of the element. I suppose I could use a meta-function to strip off the &, but it seems like the mpl version of at_c should do what I want.
value_at should be your friend. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Chris Weed wrote:
Hi, I am trying to get the type of the first element in a fusion vector using mpl::at_c. This seems simple enough.
// Here is the code #include
#include int main() { typedef boost::fusion::vector
VectorType; typedef boost::mpl::at_c
::type value0; return 0; }
You'll need to include the at.hpp counterpart of fusion, or
bring in the whole set of intrinsics:
#include
participants (3)
-
Chris Weed
-
Joel de Guzman
-
Sohail Somani