Skip to content

Commit

Permalink
Trailing return types in basic expression operators
Browse files Browse the repository at this point in the history
  • Loading branch information
rbock committed Apr 10, 2016
1 parent 4d538e8 commit 434f691
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions include/sqlpp11/basic_expression_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ namespace sqlpp
template <template <typename Lhs, typename Rhs> class Expr, typename Lhs, typename Rhs>
struct comparison_expression_impl<true, Expr, Lhs, Rhs>
{
using type = Expr<Lhs, Rhs>;
using type = Expr<wrap_operand_t<Lhs>, wrap_operand_t<Rhs>>;
};
}
template <typename Check, template <typename Lhs, typename Rhs> class Expr, typename Lhs, typename Rhs>
using comparison_expression_t = typename detail::comparison_expression_impl<Check::value, Expr, Lhs, Rhs>::type;
template <template <typename Lhs, typename Rhs> class Expr, typename Lhs, typename Rhs>
using comparison_expression_t =
typename detail::comparison_expression_impl<check_comparison_t<Lhs, Rhs>::value, Expr, Lhs, Rhs>::type;

namespace detail
{
Expand All @@ -108,8 +109,7 @@ namespace sqlpp
template <template <typename Lhs, typename Rhs> class NewExpr, typename T>
struct _new_binary_expression
{
using _check = check_comparison_t<Expr, T>;
using type = comparison_expression_t<_check, NewExpr, Expr, wrap_operand_t<T>>;
using type = comparison_expression_t<NewExpr, Expr, T>;
};
template <template <typename Lhs, typename Rhs> class NewExpr, typename T>
using _new_binary_expression_t = typename _new_binary_expression<NewExpr, T>::type;
Expand All @@ -122,7 +122,7 @@ namespace sqlpp
};

template <typename T>
_new_binary_expression_t<equal_to_t, T> operator==(T t) const
auto operator==(T t) const -> _new_binary_expression_t<equal_to_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>::_();
Expand All @@ -131,7 +131,7 @@ namespace sqlpp
}

template <typename T>
_new_binary_expression_t<not_equal_to_t, T> operator!=(T t) const
auto operator!=(T t) const -> _new_binary_expression_t<not_equal_to_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>::_();
Expand All @@ -140,7 +140,7 @@ namespace sqlpp
}

template <typename T>
_new_binary_expression_t<less_than_t, T> operator<(T t) const
auto operator<(T t) const -> _new_binary_expression_t<less_than_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>::_();
Expand All @@ -149,7 +149,7 @@ namespace sqlpp
}

template <typename T>
_new_binary_expression_t<less_equal_t, T> operator<=(T t) const
auto operator<=(T t) const -> _new_binary_expression_t<less_equal_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>::_();
Expand All @@ -158,7 +158,7 @@ namespace sqlpp
}

template <typename T>
_new_binary_expression_t<greater_than_t, T> operator>(T t) const
auto operator>(T t) const -> _new_binary_expression_t<greater_than_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>::_();
Expand All @@ -167,43 +167,43 @@ namespace sqlpp
}

template <typename T>
_new_binary_expression_t<greater_equal_t, T> operator>=(T t) const
auto operator>=(T t) const -> _new_binary_expression_t<greater_equal_t, T>
{
using rhs = wrap_operand_t<T>;
check_comparison_t<Expr, rhs>::_();

return {*static_cast<const Expr*>(this), rhs{t}};
}

is_null_t<Expr> is_null() const
auto is_null() const -> is_null_t<Expr>
{
return {*static_cast<const Expr*>(this)};
}

is_not_null_t<Expr> is_not_null() const
auto is_not_null() const -> is_not_null_t<Expr>
{
return {*static_cast<const Expr*>(this)};
}

sort_order_t<Expr, sort_type::asc> asc() const
auto asc() const -> sort_order_t<Expr, sort_type::asc>
{
return {*static_cast<const Expr*>(this)};
}

sort_order_t<Expr, sort_type::desc> desc() const
auto desc() const -> sort_order_t<Expr, sort_type::desc>
{
return {*static_cast<const Expr*>(this)};
}

template <typename... T>
typename _new_nary_expression<in_t, T...>::type in(T... t) const
auto in(T... t) const -> typename _new_nary_expression<in_t, T...>::type
{
check_in_t<Expr, wrap_operand_t<T>...>::_();
return {*static_cast<const Expr*>(this), typename wrap_operand<T>::type{t}...};
}

template <typename... T>
typename _new_nary_expression<not_in_t, T...>::type not_in(T... t) const
auto not_in(T... t) const -> typename _new_nary_expression<not_in_t, T...>::type
{
check_in_t<Expr, wrap_operand_t<T>...>::_();
return {*static_cast<const Expr*>(this), typename wrap_operand<T>::type{t}...};
Expand Down

0 comments on commit 434f691

Please sign in to comment.