Boost logo

Boost :

Subject: Re: [boost] [variant] Breaking change introduced by variadic support
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2014-01-22 02:55:25


2014/1/21 Agustín K-ballo Bergé <kaballo86_at_[hidden]>

> While trying to make _Boost.Spirit_ work after the breaking changes, I
> found a problem with the following snippet:
>
> #include <boost/variant.hpp>
> #include <boost/mpl/bool.hpp>
>
> template <typename T>
> struct is_container : boost::mpl::false_ {};
>
> template <typename T>
> struct is_container<boost::variant<T>> : is_container<T> {};
>
> template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
> struct is_container<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>>
> : boost::mpl::bool_<is_container<T0>::value
> || is_container<boost::variant<BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T)>>::value>
> // #13
> {};
>
> int main()
> {
> is_container<boost::variant<double, int>>::value;
> }
>
> If I understand correctly, this should work for both the variadic and
> non-variadic cases. However, trying this with both MSVC2013 and NovCTP13
> gives the following error:
>
> > main.cpp(13): error C2976: 'boost::variant' : too few template arguments
>

Added test case and disabled usage of variadic templates in Boost.Variant
for MSVC2013 (
https://github.com/boostorg/variant/commit/63fb3ff4270e3032c0a171507bb41718e4762685
)

-- 
Best regards,
Antony Polukhin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk