mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-05-07 20:00:06 -05:00
Fixed compile time checks for concat
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <sstream>
|
||||
#include <sqlpp11/text.h>
|
||||
#include <sqlpp11/detail/set.h>
|
||||
|
||||
namespace sqlpp
|
||||
{
|
||||
@@ -37,10 +38,10 @@ namespace sqlpp
|
||||
struct text;
|
||||
|
||||
template<typename Text, typename... Args>
|
||||
struct concat_t: public Text::template operators<concat_t<Args...>>
|
||||
struct concat_t: public Text::template operators<concat_t<Text, Args...>>
|
||||
{
|
||||
using _valid_args = typename detail::make_set_if<is_text_t, Args...>::type;
|
||||
static_assert(_valid_args::size::value == sizeof...(Args), "at least one non-text argument detected in concat()");
|
||||
using _valid_args = typename detail::make_set_if_not<is_text_t, Args...>::type;
|
||||
static_assert(_valid_args::size::value == 0, "at least one non-text argument detected in concat()");
|
||||
|
||||
using _value_type = Text;
|
||||
struct _name_t
|
||||
|
||||
@@ -107,18 +107,11 @@ namespace sqlpp
|
||||
template<typename T>
|
||||
using _constraint = operand_t<T, is_text_t>;
|
||||
|
||||
struct plus_
|
||||
{
|
||||
using _value_type = boolean;
|
||||
static constexpr const char* _name = "+";
|
||||
};
|
||||
|
||||
template<typename Base>
|
||||
struct operators: public basic_operators<Base, _constraint>
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
detail::concat_t<Base, Base, typename _constraint<T>::type> operator+(T&& t) const
|
||||
detail::concat_t<text, Base, typename _constraint<T>::type> operator+(T&& t) const
|
||||
{
|
||||
return { *static_cast<const Base*>(this), std::forward<T>(t) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user