Consider this use case of a static constexpr
member:
// smart_enum.h
class smart_enum {
// Some data, operations, etc.
// Cannot use constexpr here, smart_enum is incomplete at this point
static const smart_enum first, second;
};
constexpr smart_enum smart_enum::first = {}, smart_enum::second = {};
Are first
and second
automatically inline
variables? Or do I need to qualify them as such? Or am I unable to qualify them as inline and need to provide a definition in some source file later? I have always been confused by this "redefinition" from const
to constexpr
and would like more light to be shed on what this really means.
Specifically I am wondering about the interaction of const
declaration to constexpr
definition and how that plays out with automatic inline
of a static constexpr
(Redefinitions of constexpr static data members are allowed now? (but not inline const)?)