Fix Traits::IsSpecializationOf to ignore cv qualifier
So eg. const/volatile std::string is also considered a specialization of std::basic_string like one would expect.
This commit is contained in:
parent
34eac527ee
commit
44e4d1335a
|
@ -54,11 +54,17 @@ template <typename... Condition> using EnableIfAny = typename std::enable_if<Any
|
||||||
/// \brief Shortcut for std::enable_if to apply Traits::Any, negate the condition and omit ::value and ::type.
|
/// \brief Shortcut for std::enable_if to apply Traits::Any, negate the condition and omit ::value and ::type.
|
||||||
template <typename... Condition> using DisableIfAny = typename std::enable_if<!Any<Condition...>::value, Detail::Enabler>::type;
|
template <typename... Condition> using DisableIfAny = typename std::enable_if<!Any<Condition...>::value, Detail::Enabler>::type;
|
||||||
|
|
||||||
/// \brief Evaluates to Bool<true> if the specified type is based on the specified \tparam Template; otherwise evaluates to Bool<false>.
|
/// \cond
|
||||||
template <typename T, template <typename...> class Template> struct IsSpecializationOf : Bool<false> {
|
namespace Detail {
|
||||||
|
template <typename T, template <typename...> class Template> struct IsSpecializationOfHelper : Bool<false> {
|
||||||
};
|
};
|
||||||
|
template <template <typename...> class Template, typename... Args> struct IsSpecializationOfHelper<Template<Args...>, Template> : Bool<true> {
|
||||||
|
};
|
||||||
|
} // namespace Detail
|
||||||
|
/// \endcond
|
||||||
/// \brief Evaluates to Bool<true> if the specified type is based on the specified \tparam Template; otherwise evaluates to Bool<false>.
|
/// \brief Evaluates to Bool<true> if the specified type is based on the specified \tparam Template; otherwise evaluates to Bool<false>.
|
||||||
template <template <typename...> class Template, typename... Args> struct IsSpecializationOf<Template<Args...>, Template> : Bool<true> {
|
template <typename Type, template <typename...> class... TemplateTypes>
|
||||||
|
struct IsSpecializationOf : Detail::IsSpecializationOfHelper<typename std::remove_cv<Type>::type, TemplateTypes...> {
|
||||||
};
|
};
|
||||||
/// \brief Evaluates to Bool<true> if the specified type is based on one of the specified templates; otherwise evaluates to Bool<false>.
|
/// \brief Evaluates to Bool<true> if the specified type is based on one of the specified templates; otherwise evaluates to Bool<false>.
|
||||||
template <typename Type, template <typename...> class... TemplateTypes> struct IsSpecializingAnyOf : Bool<false> {
|
template <typename Type, template <typename...> class... TemplateTypes> struct IsSpecializingAnyOf : Bool<false> {
|
||||||
|
|
|
@ -90,8 +90,10 @@ static_assert(IsCString<const char *>::value, "IsCString: positive case");
|
||||||
static_assert(!IsString<int *>::value, "IsString: negative case");
|
static_assert(!IsString<int *>::value, "IsString: negative case");
|
||||||
static_assert(!IsString<stringstream>::value, "IsString: negative case");
|
static_assert(!IsString<stringstream>::value, "IsString: negative case");
|
||||||
static_assert(IsString<const char *>::value, "IsString: positive case");
|
static_assert(IsString<const char *>::value, "IsString: positive case");
|
||||||
static_assert(IsString<string>::value, "IsCString: positive case");
|
static_assert(IsString<string>::value, "IsString: positive case");
|
||||||
static_assert(IsString<u16string>::value, "IsCString: positive case");
|
static_assert(IsString<const string>::value, "IsString: positive case (const)");
|
||||||
|
static_assert(IsString<volatile string>::value, "IsString: positive case (volatile)");
|
||||||
|
static_assert(IsString<u16string>::value, "IsString: positive case");
|
||||||
|
|
||||||
static_assert(!IsComplete<TestIncomplete>::value, "IsComplete: negative case");
|
static_assert(!IsComplete<TestIncomplete>::value, "IsComplete: negative case");
|
||||||
static_assert(IsComplete<CountableStruct>::value, "IsComplete: positive case");
|
static_assert(IsComplete<CountableStruct>::value, "IsComplete: positive case");
|
||||||
|
|
Loading…
Reference in New Issue