diff --git a/include/sqlpp11/cte.h b/include/sqlpp11/cte.h index 95cca8d3..cd1b5f11 100644 --- a/include/sqlpp11/cte.h +++ b/include/sqlpp11/cte.h @@ -167,7 +167,7 @@ namespace sqlpp using _parameters = parameters_of; using _alias_t = typename AliasProvider::_alias_t; - constexpr static bool _is_recursive = detail::is_element_of>::value; + constexpr static bool _is_recursive = required_ctes_of::template count(); using _column_tuple_t = std::tuple>...>; @@ -261,7 +261,7 @@ namespace sqlpp { static_assert(required_tables_of::size::value == 0, "common table expression must not use unknown tables"); - static_assert(not detail::is_element_of>::value, + static_assert(not required_ctes_of::template count(), "common table expression must not self-reference in the first part, use union_all/union_distinct " "for recursion"); static_assert(is_static_result_row_t>::value, diff --git a/include/sqlpp11/detail/type_set.h b/include/sqlpp11/detail/type_set.h index ebbb2293..16fdce03 100644 --- a/include/sqlpp11/detail/type_set.h +++ b/include/sqlpp11/detail/type_set.h @@ -45,29 +45,41 @@ namespace sqlpp template struct is_element_of; + template + struct _base + { + }; + // A type set template struct type_set { + private: + struct _impl : _base... + { + }; + + public: using size = std::integral_constant; using _is_type_set = std::true_type; - static_assert(std::is_same>::value, - "use make_type_set to construct a typeset"); + template + static constexpr bool count() + { + return std::is_base_of<_base, _impl>::value; + } template struct insert { - using type = - typename std::conditional::value, type_set, type_set>::type; + using type = typename std::conditional(), type_set, type_set>::type; }; template