From 1b9a4b15940fce6a9c875bf5fc70cc4c9e16b4c2 Mon Sep 17 00:00:00 2001 From: rbock Date: Sun, 25 Dec 2016 10:44:22 +0100 Subject: [PATCH] Replace is_compatible function with class template MSVC choked on that function (claimed that the number of arguments was incorrect) --- include/sqlpp11/result_row.h | 27 ++++++++++++++------------- include/sqlpp11/union.h | 6 ++---- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/include/sqlpp11/result_row.h b/include/sqlpp11/result_row.h index 883065e3..bebe78dd 100644 --- a/include/sqlpp11/result_row.h +++ b/include/sqlpp11/result_row.h @@ -186,19 +186,6 @@ namespace sqlpp using _impl = detail::result_row_impl; bool _is_valid; - template - static constexpr auto is_compatible(detail::type_vector>) -> - typename std::enable_if::type - { - return logic::all_t::value; - } - - template - static constexpr auto is_compatible(detail::type_vector>) -> - typename std::enable_if::type - { - return false; - } result_row_t() : _impl(), _is_valid(false) { } @@ -264,6 +251,20 @@ namespace sqlpp } }; + template + struct is_result_compatible + { + static constexpr auto value = false; + }; + + template + struct is_result_compatible, + result_row_t, + typename std::enable_if::type> + { + static constexpr auto value = logic::all_t::value; + }; + template struct dynamic_result_row_t : public detail::result_row_impl, FieldSpecs...> diff --git a/include/sqlpp11/union.h b/include/sqlpp11/union.h index 6a3920f1..624e5ff2 100644 --- a/include/sqlpp11/union.h +++ b/include/sqlpp11/union.h @@ -215,8 +215,7 @@ namespace sqlpp using lhs_result_row_t = get_result_row_t>; using rhs_result_row_t = get_result_row_t; - constexpr auto vec_rhs = detail::type_vector{}; - static_assert(lhs_result_row_t::is_compatible(vec_rhs), + static_assert(is_result_compatible::value, "both arguments in a union have to have the same result columns (type and name)"); return _union_impl(check_union_t, Rhs>{}, rhs); @@ -234,8 +233,7 @@ namespace sqlpp using lhs_result_row_t = get_result_row_t>; using rhs_result_row_t = get_result_row_t; - constexpr auto vec_rhs = detail::type_vector{}; - static_assert(lhs_result_row_t::is_compatible(vec_rhs), + static_assert(is_result_compatible::value, "both arguments in a union have to have the same result columns (type and name)"); return _union_impl(check_union_t, Rhs>{}, rhs);