Boost logo

Boost :

Subject: [boost] [mpl] std::integral_constant support?
From: Eric Niebler (eric_at_[hidden])
Date: 2012-07-15 13:24:01

The following reasonable-seeming use of mpl::plus doesn't compile:

    #include <utility>
    #include <boost/mpl/plus.hpp>

    typedef std::integral_constant<int, 1> one;
    typedef boost::mpl::plus<one, one>::type two;

That's because mpl only works with its own integral constant wrappers,
not the standard one. That seems unfortunate to me. Is there any
interest in supporting this?

Here's the error (from clang trunk with glibc++):

    1> In file included from main.cpp:2:
    1> In file included from
    1> In file included from
    1> In file included from
error: no type named 'tag' in 'std::integral_constant<int, 1>'
    1> typedef typename T::tag type;
    1> ~~~~~~~~~~~~^~~
note: in instantiation of template class
'boost::mpl::plus_tag<std::integral_constant<int, 1> >' requested here
    1> typename plus_tag<N1>::type
    1> ^

Eric Niebler
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at