mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Minor cleanup in type_sets
This commit is contained in:
parent
6d2a5e6ac1
commit
77d737b401
@ -39,6 +39,9 @@ namespace sqlpp
|
|||||||
template<typename... T>
|
template<typename... T>
|
||||||
struct make_type_set;
|
struct make_type_set;
|
||||||
|
|
||||||
|
template<typename... T>
|
||||||
|
using make_type_set_t = typename make_type_set<T...>::type;
|
||||||
|
|
||||||
template<typename E, typename SET>
|
template<typename E, typename SET>
|
||||||
struct is_element_of;
|
struct is_element_of;
|
||||||
|
|
||||||
@ -49,7 +52,7 @@ namespace sqlpp
|
|||||||
using size = std::integral_constant<size_t, sizeof...(Elements)>;
|
using size = std::integral_constant<size_t, sizeof...(Elements)>;
|
||||||
using _is_type_set = std::true_type;
|
using _is_type_set = std::true_type;
|
||||||
|
|
||||||
static_assert(std::is_same<type_set, typename make_type_set<Elements...>::type>::value, "use make_type_set to construct a set");
|
static_assert(std::is_same<type_set, make_type_set_t<Elements...>>::value, "use make_type_set to construct a typeset");
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct insert
|
struct insert
|
||||||
@ -90,7 +93,7 @@ namespace sqlpp
|
|||||||
template<typename... LElements, typename... RElements>
|
template<typename... LElements, typename... RElements>
|
||||||
struct joined_set<type_set<LElements...>, type_set<RElements...>>
|
struct joined_set<type_set<LElements...>, type_set<RElements...>>
|
||||||
{
|
{
|
||||||
using type = typename make_type_set<LElements..., RElements...>::type;
|
using type = make_type_set_t<LElements..., RElements...>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename L, typename R>
|
template<typename L, typename R>
|
||||||
@ -138,9 +141,6 @@ namespace sqlpp
|
|||||||
using type = typename make_type_set<Rest...>::type::template insert<T>::type;
|
using type = typename make_type_set<Rest...>::type::template insert<T>::type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... T>
|
|
||||||
using make_type_set_t = typename make_type_set<T...>::type;
|
|
||||||
|
|
||||||
template<template<typename> class Predicate, typename... T>
|
template<template<typename> class Predicate, typename... T>
|
||||||
struct make_type_set_if;
|
struct make_type_set_if;
|
||||||
|
|
||||||
@ -167,8 +167,11 @@ namespace sqlpp
|
|||||||
using type = typename make_type_set_if<InversePredicate, T...>::type;
|
using type = typename make_type_set_if<InversePredicate, T...>::type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<template<typename> class Predicate, typename... T>
|
||||||
|
using make_type_set_if_not_t = typename make_type_set_if_not<Predicate, T...>::type;
|
||||||
|
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
using has_duplicates = std::integral_constant<bool, make_type_set<T...>::type::size::value != sizeof...(T)>;
|
using has_duplicates = std::integral_constant<bool, make_type_set_t<T...>::size::value != sizeof...(T)>;
|
||||||
|
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
struct make_joined_set
|
struct make_joined_set
|
||||||
@ -204,7 +207,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
template<typename E>
|
template<typename E>
|
||||||
using is_subtrahend = is_element_of<E, type_set<Subtrahends...>>;
|
using is_subtrahend = is_element_of<E, type_set<Subtrahends...>>;
|
||||||
using type = typename make_type_set_if_not<is_subtrahend, Minuends...>::type;
|
using type = make_type_set_if_not_t<is_subtrahend, Minuends...>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Minuend, typename Subtrahend>
|
template<typename Minuend, typename Subtrahend>
|
||||||
@ -221,7 +224,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
template<typename E>
|
template<typename E>
|
||||||
using is_in_both = all_t<is_element_of<E, type_set<LhsElements...>>::value, is_element_of<E, type_set<RhsElements...>>::value>;
|
using is_in_both = all_t<is_element_of<E, type_set<LhsElements...>>::value, is_element_of<E, type_set<RhsElements...>>::value>;
|
||||||
using type = typename make_type_set_if<is_in_both, LhsElements...>::type;
|
using type = make_type_set_if_t<is_in_both, LhsElements...>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
@ -237,7 +240,7 @@ namespace sqlpp
|
|||||||
template<template<typename> class Transformation, typename... E>
|
template<template<typename> class Transformation, typename... E>
|
||||||
struct transform_set<Transformation, type_set<E...>>
|
struct transform_set<Transformation, type_set<E...>>
|
||||||
{
|
{
|
||||||
using type = typename make_type_set<Transformation<E>...>::type;
|
using type = make_type_set_t<Transformation<E>...>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<template<typename> class Transformation, typename T>
|
template<template<typename> class Transformation, typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user