`static constexpr` function called in a constant expression is…an error?

As T.C. demonstrated with some links in a comment, the standard is not quite clear on this; a similar problem arises with trailing return types using decltype(memberfunction()). The central problem is that class members are generally not considered to be declared until after the class in which they’re declared is complete. Thus, regardless of the … Read more

What is the difference between C++03 `throw()` specifier and C++11 `noexcept`?

Exception specifiers were deprecated because exception specifiers are generally a terrible idea. noexcept was added because it’s the one reasonably useful use of an exception specifier: knowing when a function won’t throw an exception. Thus it becomes a binary choice: functions that will throw and functions that won’t throw. noexcept was added rather than just … Read more

Difference between C++03 throw() specifier C++11 noexcept

Exception specifiers were deprecated because exception specifiers are generally a terrible idea. noexcept was added because it’s the one reasonably useful use of an exception specifier: knowing when a function won’t throw an exception. Thus it becomes a binary choice: functions that will throw and functions that won’t throw. noexcept was added rather than just … Read more

tech