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

Minor cleanup

This commit is contained in:
Roland Bock 2013-11-15 10:09:42 +01:00
parent e7c6f88d23
commit 81309ce58f
2 changed files with 5 additions and 12 deletions

View File

@ -69,7 +69,7 @@ namespace sqlpp
void push_back(Expr&& expr)
{
_dynamic_expression_names.push_back(std::decay<Expr>::type::_name_t::_get_name());
_dynamic_expressions.push_back(std::forward<Expr>(expr));
_dynamic_expressions.emplace_back(std::forward<Expr>(expr));
}
void serialize(std::ostream& os, Db& db, bool first) const
{

View File

@ -28,12 +28,11 @@
#define SQLPP_WHERE_H
#include <ostream>
#include <vector>
#include <sqlpp11/select_fwd.h>
#include <sqlpp11/expression.h>
#include <sqlpp11/type_traits.h>
#include <sqlpp11/detail/set.h>
#include <sqlpp11/detail/serializable.h>
#include <sqlpp11/detail/serializable_list.h>
namespace sqlpp
{
@ -65,7 +64,7 @@ namespace sqlpp
void add(Expr&& expr)
{
static_assert(is_expression_t<typename std::decay<Expr>::type>::value, "invalid expression argument in where()");
_conditions.push_back(std::forward<Expr>(expr));
_conditions.emplace_back(std::forward<Expr>(expr));
}
void serialize(std::ostream& os, Db& db) const
@ -75,16 +74,10 @@ namespace sqlpp
os << " WHERE ";
bool first = true;
for (const auto& condition : _conditions)
{
if (not first)
os << " AND ";
condition.serialize(os, db);
first = false;
}
_conditions.serialize(os, db, " AND ", true);
}
std::vector<detail::serializable_t<Db>> _conditions;
detail::serializable_list<Db> _conditions;
};
}