#pragma once #include "tables.h" namespace cpphibernate { namespace schema { namespace __impl { /* tables_t */ template using tables_t = hana::tuple; /* tables_builder */ template struct tables_builder { template static constexpr decltype(auto) apply(T_args&&...) { static_assert(sizeof...(T_args) == -1, "Invalid parameters for make_tables(...)!"); } }; template struct tables_builder< mp::list, mp::enable_if_t>...>>> { template static constexpr decltype(auto) apply(T_args&&... args) { using tables_type = tables_t; return tables_type(std::forward(args)...); } }; /* find_table_builder */ template struct find_table_builder { template static constexpr decltype(auto) apply(T_args&&... args) { static_assert(sizeof...(T_args) == -1, "Invalid parameters for find_table(...)!"); } }; template struct find_table_builder< mp::list, mp::enable_if_t< is_tables_v> && mp::is_same_v> >> { template struct helper; template struct helper { static_assert(N != N, "Table for given datatype does not exist!"); }; template struct helper()[hana::size_c].wrapped_dataset, T_dataset { }))::value>> { static constexpr decltype(auto) apply(T_tables&& tables) { return helper::apply(std::forward(tables)); } }; template struct helper()[hana::size_c].wrapped_dataset, T_dataset { }))::value>> { static constexpr decltype(auto) apply(T_tables&& tables) { return std::forward(tables)[hana::size_c]; } }; static constexpr decltype(auto) apply(T_tables&& tables, T_dataset&&) { using count_type = mp::decay_t()))>; return helper<0, count_type::value>::apply(std::forward(tables)); } }; /* is_tables_impl */ template struct is_tables_impl : mp::false_t { }; template struct is_tables_impl< tables_t, mp::enable_if_t>...>>> : mp::true_t { }; } /* is_tables */ template struct is_tables : public __impl::is_tables_impl { }; } }