From d831f98c9a6dc0179fe98a48b38d25663ba67344 Mon Sep 17 00:00:00 2001 From: rbock Date: Wed, 7 May 2014 18:51:18 +0200 Subject: [PATCH] Made parameter_list's bind non-recursive --- include/sqlpp11/parameter_list.h | 21 +++++++-------------- include/sqlpp11/vendor/interpret_tuple.h | 2 +- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/sqlpp11/parameter_list.h b/include/sqlpp11/parameter_list.h index fcb0cc56..1201159e 100644 --- a/include/sqlpp11/parameter_list.h +++ b/include/sqlpp11/parameter_list.h @@ -27,8 +27,9 @@ #ifndef SQLPP_PARAMETER_LIST_H #define SQLPP_PARAMETER_LIST_H -#include #include +#include +#include namespace sqlpp { @@ -50,23 +51,15 @@ namespace sqlpp template void _bind(Target& target) const { - _bind_impl(target, index_t<0>()); + _bind_impl(target, ::sqlpp::detail::make_index_sequence{}); } private: - template struct index_t {}; // this is just for overloading - - template - void _bind_impl(Target& target, const index_t&) const - { - const auto& parameter = static_cast::type&>(*this)(); - parameter._bind(target, index); - _bind_impl(target, index_t()); - } - - template - void _bind_impl(Target& target, const index_t&) const + template + void _bind_impl(Target& target, const ::sqlpp::detail::index_sequence&) const { + using swallow = int[]; // see interpret_tuple.h + (void) swallow{(static_cast::type&>(*this)()._bind(target, Is), 0)...}; } }; diff --git a/include/sqlpp11/vendor/interpret_tuple.h b/include/sqlpp11/vendor/interpret_tuple.h index 1f75129b..aa12c9b8 100644 --- a/include/sqlpp11/vendor/interpret_tuple.h +++ b/include/sqlpp11/vendor/interpret_tuple.h @@ -55,7 +55,7 @@ namespace sqlpp // See also: "http://stackoverflow.com/questions/6245735/pretty-print-stdtuple/6245777#6245777" // Beware of gcc-bug: "http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51253", otherwise an empty swallow struct could be used using swallow = int[]; - (void) swallow{(interpret_tuple_element(std::get(t), separator, context, Is) ,0)...}; + (void) swallow{(interpret_tuple_element(std::get(t), separator, context, Is), 0)...}; return context; }