Boost logo

Boost Users :

Subject: Re: [Boost-users] recursive variant with mpl::vector
From: Surya Kiran Gullapalli (suryakiran.gullapalli_at_[hidden])
Date: 2010-05-21 05:23:37


Got it...

typedef mpl::transform < VariantTypes, boost::unwrap_recursive <mpl::_1>
>::type BaseVariantTypes ;

template <class T>
struct variant_type : public mpl::if_ < typename mpl::contains
<BaseVariantTypes, T>::type, valid_type<T>, invalid_type<T> >::type { };

Thanks,
Surya

On Fri, May 21, 2010 at 14:18, Surya Kiran Gullapalli <
suryakiran.gullapalli_at_[hidden]> wrote:

> Hello all,
> I'm trying to create a recursive variant over an MPL vector.<http://?shva=1#drafts/128ba01f42cb2169>
>
> attached is the code.
>
> I'm trying to add a templated function isType, which will return true if
> the type stored in variant is the type queried for or false otherwise.
>
> This doesn't work for recursive types.
>
> In the example, I expect the program outputs "Map Type" because the type
> stored in the variant is a map. but it says the type is not map.
>
> The problem is mpl::contains returns false for map type. (The type stored
> in mpl vector is boost::recursive_wrapper< map ... >, where as, I'm querying
> for map...). what is the way forward from here.
>
> Thanks,
> Surya.
>



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