In C++11, constexpr on a member function implies const. That was changed in C++14.
I have some code that has a member function that should be constexpr, but cannot be const, so I'd like it to be constexpr if compiled with std c++14 or later. One way to do this is:
class Foo {
#if _cplusplus >= 201402L
constexpr
#endif
int baz(const Bar& bar);
};
Is there a better way to express this, preferably without the preprocessor?