Subject: [Boost-bugs] [Boost C++ Libraries] #9971: Use constexpr for boost::mpl::c_str::value when possible.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-01 11:23:47
#9971: Use constexpr for boost::mpl::c_str::value when possible.
-------------------------------------+-----------------------
Reporter: ytj000@⦠| Owner: agurtovoy
Type: Patches | Status: new
Milestone: To Be Determined | Component: mpl
Version: Boost Development Trunk | Severity: Problem
Keywords: |
-------------------------------------+-----------------------
Right now boost::mpl::c_str::value is a static const member variable.
I think it is a decent idea to add the constexpr keyword here.
I have a patch for this issue. Here is an example why it is useful:
{{{
#include<boost/mpl/string.hpp>
int main() {
using H = boost::mpl::string<'h'>;
static_assert(boost::mpl::c_str<H>::value[0] == 'h', "");
}
}}}
Without my patch, compiler will complain we could not use c_str::value in
constant expression. With my patch, compiler will accept this code.
Tested in clang++ 3.4, CentOS 6.3, but I think GCC should works as well.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9971> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC