0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Fix expressions for unsigned integral as suggested by @fraillt

This commit is contained in:
rbock 2019-08-20 18:32:16 +02:00
parent 43ec2343c3
commit 7f29a0b126
2 changed files with 8 additions and 7 deletions

View File

@ -48,14 +48,14 @@ namespace sqlpp
struct return_type_plus<L, R, binary_operand_check_t<L, is_unsigned_integral_t, R, is_numeric_t>>
{
using check = consistent_t;
using type = value_type_of<wrap_operand_t<R>>;
using type = plus_t<wrap_operand_t<L>, value_type_of<wrap_operand_t<R>>, wrap_operand_t<R>>;
};
template <typename L, typename R>
struct return_type_minus<L, R, binary_operand_check_t<L, is_unsigned_integral_t, R, is_numeric_not_unsigned_t>>
{
using check = consistent_t;
using type = value_type_of<wrap_operand_t<R>>;
using type = minus_t<wrap_operand_t<L>, value_type_of<wrap_operand_t<R>>, wrap_operand_t<R>>;
};
template <typename L, typename R>
@ -69,14 +69,14 @@ namespace sqlpp
struct return_type_multiplies<L, R, binary_operand_check_t<L, is_unsigned_integral_t, R, is_numeric_t>>
{
using check = consistent_t;
using type = value_type_of<wrap_operand_t<R>>;
using type = multiplies_t<wrap_operand_t<L>, value_type_of<wrap_operand_t<R>>, wrap_operand_t<R>>;
};
template <typename L, typename R>
struct return_type_divides<L, R, binary_operand_check_t<L, is_unsigned_integral_t, R, is_numeric_t>>
{
using check = consistent_t;
using type = value_type_of<wrap_operand_t<R>>;
using type = divides_t<wrap_operand_t<L>, wrap_operand_t<R>>;
};
template <typename L, typename R>

View File

@ -39,9 +39,9 @@ namespace alias
SQLPP_ALIAS_PROVIDER(b)
SQLPP_ALIAS_PROVIDER(left)
SQLPP_ALIAS_PROVIDER(right)
}
} // namespace alias
int SelectType(int, char* [])
int SelectType(int, char*[])
{
MockDb db = {};
MockDb::_serializer_context_t printer = {};
@ -163,7 +163,8 @@ int SelectType(int, char* [])
static_assert(sqlpp::is_integral_t<sqlpp::return_type_minus_t<T, sqlpp::integral>>::value, "type requirement");
static_assert(sqlpp::is_integral_t<sqlpp::return_type_plus_t<T, sqlpp::integral>>::value, "type requirement");
static_assert(sqlpp::is_integral_t<sqlpp::return_type_multiplies_t<T, sqlpp::integral>>::value, "type requirement");
static_assert(sqlpp::is_integral_t<sqlpp::return_type_divides_t<T, sqlpp::integral>>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<sqlpp::return_type_divides_t<T, sqlpp::integral>>::value,
"type requirement");
static_assert(sqlpp::is_integral_t<sqlpp::return_type_minus_t<sqlpp::integral, T>>::value, "type requirement");
static_assert(sqlpp::is_integral_t<sqlpp::return_type_plus_t<sqlpp::integral, T>>::value, "type requirement");
static_assert(sqlpp::is_integral_t<sqlpp::return_type_multiplies_t<sqlpp::integral, T>>::value, "type requirement");