Boost logo

Boost :

Subject: Re: [boost] [config][mpl][type_traits][integer] BOOST_STATIC_CONSTANT should use constexpr
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-04-21 10:03:29


Le 21/04/13 13:08, John Maddock a écrit :
>>> As for the original question, this is such a pervasive breaking
>>> change, I
>>> think a new macro is inevitable I'm afraid :-(
>>
>> New macro will do exactly what the old macro did, but using C++11
>> feature. Code in all Boost libraries will be changed to use new macro.
>> So the old macro will be required only for users code that use macro
>> and attempts to take address of constant...
>>
>> To me, it looks less obscuring to have one macro and a note for users
>> to use BOOST_CONSTEXPR_OR_CONST for out-of-line definition; than two
>> macro (which one shall be used by default?) that do the same thing but
>> very slightly differ in details.
>
> Here's a radical idea: are there any compilers still around that we
> care about which require the enum workaround? Certainly not VC6 ;-)
>
> So we could recomend libraries use:
>
> template <class T>
> struct foo
> {
> BOOST_STATIC_CONSTEXPR bool value = some_value;
or
    static BOOST_CONSTEXPR_OR_CONST bool value = some_value;

> };
>
> template <class T>
> BOOST_CONSTEXPR_OR_CONST bool foo<T>::value;
>
> Thoughts?
>
I'm not against this radical alternative, and I even like it. I don't
know which compilers need the enum workaround and if Boost should
support them.

What I want is just that integral_constant use them so that all the
traits in Boost conforms to the C++11 standard.

I have applied some changes to [config][mpl][type_traits][integer] and
the number of changes to make integral_constant work is not so big. I
will comeback later with more information.

Best,
Vicente


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