|
Boost Users : |
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-05-06 11:53:48
First I was going to suggest you to use mpl::front to retrieve the first
element of the type sequence, but the new variant doc does not state that
the first element of the type sequence will be created in the variant's
memory. I remember to read that it was once the case.
You can try this: (But I am not sure if it works or is portable)
typedef typename mpl::transform<
recursive_enabled_types
, unwrap_recursive<mpl::_1>
>::type types;
typedef boost::mpl::front<types>::type first_type;
MyVariantType v;
first_type *value = get<first_type>(&v);
Regards,
Ovanes
On Tue, May 6, 2008 at 5:33 PM, Igor R. <igor_rubinov_at_[hidden]> wrote:
> Hi Ovanes,
>
> Yes, I know, but that's not what need.
>
>
>
> ------------------------------
> Date: Tue, 6 May 2008 17:25:08 +0200
> From: om_boost_at_[hidden]
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [variant] how to get 1st bounded type
>
> You can apply the visitor to the variant and receive the instance of the
> stored type.
>
>
> With Kind Regards,
> Ovanes
>
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net