Boost logo

Boost :

Subject: Re: [boost] [config][mpl][type_traits][integer] BOOST_STATIC_CONSTANT should use constexpr
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-04-20 05:15:32


2013/4/20 Vicente J. Botet Escriba <vicente.botet_at_[hidden]>:
> Would it be preferable to add BOOST_STATIC_CONSTANT_11 and change every use
> of BOOST_STATIC_CONSTANT by BOOST_STATIC_CONSTANT_11 and deprecate
> BOOST_STATIC_CONSTANT?

I would rather change the definitioon of BOOST_STATIC_CONSTANT to

# ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
# else
# define BOOST_STATIC_CONSTANT(type, assignment) static
*BOOST_CONSTEXPR_OR_CONST* type assignment
# endif

Code from example:

template <typename T>
const bool trait::value;

newer was correct, because compilers with
BOOST_NO_INCLASS_MEMBER_INITIALIZATION define it to enum. So proposed
change shall not break correct code.

--
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