mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-02 03:00:38 -06:00
Introduced field template to make result_row_t less specific.
It is sufficient to have name and type. There is no need for the result
"to know" what exact expression was used to define the column.
Surprisingly, template alias creates new templates (in contrast to
non-template using, which really just creates an alias of a type).
template<typename T> struct A{};
struct X
{
template<typename T>
using U = A<T>;
};
struct Y
{
template<typename T>
using U = A<T>;
template<>
using U<int> = X;
};
template<template<typename> class X>
struct Z{};
static_assert(std::is_same<X::U<int>, Y::U<int>>::value, "class aliases are really just aliases");
static_assert(not std::is_same<Z<X::U>, Z<Y::U>>::value, "template aliases are new templates");
int main()
{
}
This commit is contained in:
@@ -38,6 +38,7 @@ DbMock db;
|
||||
int main()
|
||||
{
|
||||
TabSample t;
|
||||
TabFoo f;
|
||||
|
||||
// Test a table
|
||||
{
|
||||
@@ -249,6 +250,17 @@ int main()
|
||||
static_assert(not sqlpp::is_value_t<decltype(a)>::value, "a multi_column is not a value");
|
||||
}
|
||||
|
||||
// Test that result sets with identical name/value combinations have identical types
|
||||
{
|
||||
auto a = select(t.alpha);
|
||||
auto b = select(f.omega.as(t.alpha));
|
||||
using A = typename decltype(a)::_result_row_t;
|
||||
using B = typename decltype(b)::_result_row_t;
|
||||
static_assert(std::is_same<decltype(t.alpha)::_value_type::_base_value_type, decltype(f.omega)::_value_type::_base_value_type>::value, "Two bigint columns must have identical base_value_type");
|
||||
//A x = std::declval<B>();
|
||||
static_assert(std::is_same<A, B>::value, "select with identical columns(name/value_type) need to have identical result_types");
|
||||
}
|
||||
|
||||
|
||||
static_assert(sqlpp::is_select_flag_t<decltype(sqlpp::all)>::value, "sqlpp::all has to be a select_flag");
|
||||
using T = sqlpp::detail::wrap_operand<int>::type;
|
||||
|
||||
Reference in New Issue
Block a user