Skip to content

Commit

Permalink
Add _v suffix for template constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire authored Jul 26, 2023
1 parent 327c17c commit ff40d7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libs/common/include/s25util/enumUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ struct IsBitset : std::false_type
{};

template<typename Enum>
constexpr bool IsValidBitset = IsBitset<Enum>::value && std::is_unsigned<std::underlying_type_t<Enum>>::value;
constexpr bool IsValidBitset_v = IsBitset<Enum>::value && std::is_unsigned<std::underlying_type_t<Enum>>::value;

template<typename Enum>
using require_validBitset = std::enable_if_t<IsValidBitset<Enum>>;
using require_validBitset = std::enable_if_t<IsValidBitset_v<Enum>>;

template<typename Enum, typename = require_validBitset<Enum>>
constexpr auto operator&(Enum lhs, Enum rhs) noexcept
Expand Down
4 changes: 2 additions & 2 deletions tests/testEnumUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ MAKE_BITSET_STRONG(Bitset);

// Check type traits
static_assert(IsBitset<InvalidBitset>::value);
static_assert(!IsValidBitset<InvalidBitset>);
static_assert(!IsValidBitset_v<InvalidBitset>);

static_assert(IsBitset<Bitset>::value);
static_assert(IsValidBitset<Bitset>);
static_assert(IsValidBitset_v<Bitset>);

BOOST_AUTO_TEST_SUITE(EnumUtils)

Expand Down

0 comments on commit ff40d7c

Please sign in to comment.