Modify

Opened 5 years ago

Last modified 5 years ago

#7192 new Feature Requests

[mpl] std::integral_constant support

Reported by: Eric Niebler Owned by: Aleksey Gurtovoy
Milestone: Boost 1.52.0 Component: mpl
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:

Description

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
/home/Eric/boost/org/trunk/boost/mpl/plus.hpp:19:
    1>  In file included from
/home/Eric/boost/org/trunk/boost/mpl/aux_/arithmetic_op.hpp:34:
    1>  In file included from
/home/Eric/boost/org/trunk/boost/mpl/aux_/include_preprocessed.hpp:37:
    1>
/home/Eric/boost/org/trunk/boost/mpl/aux_/preprocessed/gcc/plus.hpp:60:25:
error: no type named 'tag' in 'std::integral_constant<int, 1>'
    1>      typedef typename T::tag type;
    1>              ~~~~~~~~~~~~^~~
    1>
/home/Eric/boost/org/trunk/boost/mpl/aux_/preprocessed/gcc/plus.hpp:111:20:
note: in instantiation of template class
'boost::mpl::plus_tag<std::integral_constant<int, 1> >' requested here
    1>            typename plus_tag<N1>::type
    1>                     ^

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by anonymous

Yes, this should definitely work.

comment:2 in reply to:  description Changed 5 years ago by Aleksey Gurtovoy

Replying to eric_niebler:

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?

Yes, this should definitely work.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Aleksey Gurtovoy.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.