refactor(typetraits): make TConstant more in line with std style

This commit is contained in:
2021-12-20 22:41:11 +08:00
parent c973a8674b
commit c37f2c3153
2 changed files with 8 additions and 10 deletions

View File

@ -10,18 +10,16 @@ NAMESPACE_BEGIN(TypeTraits)
template <typename InType, InType InValue>
struct TConstant
{
using Type = InType;
static constexpr Type Value = InValue;
constexpr operator Type() const { return Value; }
constexpr Type operator()() const { return Value; }
using ValueType = InType;
using Type = TConstant;
static constexpr ValueType Value = InValue;
constexpr operator ValueType() const { return Value; }
constexpr ValueType operator()() const { return Value; }
};
template <bool InValue>
using TBoolConstant = TConstant<bool, InValue>;
template <int32 InValue>
using TIntegralConstant = TConstant<int32, InValue>;
using FTrue = TBoolConstant<true>;
using FFalse = TBoolConstant<false>;