Opened 8 years ago
#9971 new Patches
Use constexpr for boost::mpl::c_str::value when possible.
Reported by: | Owned by: | Aleksey Gurtovoy | |
---|---|---|---|
Milestone: | To Be Determined | Component: | mpl |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Attachments (2)
Note:
See TracTickets
for help on using tickets.
Patch