Gromacs
2025.0-dev-20241009-5c23d5f
|
#include <gromacs/utility/enumerationhelpers.h>
Helper class to determine whether a template type that is an enum class has a Count field.
Having that field makes the enum class suitable for default use with EnumerationArray
.
This class uses SFINAE to test whether the type EnumToTest
has a Count field. If so, the overload of hasCountField
returning Yes
is declared for EnumToTest. Otherwise the default returning No is declared. So for all types, hasCountField is declared and has a characteristic return type. The size of that return type is a compile-time constant that can be used to implement the value
member. Since hasCountField
is never called, it needs no definitions.
Static Public Attributes | |
static constexpr bool | value = sizeof(hasCountField<EnumToTest>(nullptr)) == sizeof(Yes) |