diff --git a/hdr/sqlite_modern_cpp/utility/function_traits.h b/hdr/sqlite_modern_cpp/utility/function_traits.h index 9decc42c..cd8fab09 100644 --- a/hdr/sqlite_modern_cpp/utility/function_traits.h +++ b/hdr/sqlite_modern_cpp/utility/function_traits.h @@ -20,17 +20,7 @@ namespace sqlite { > struct function_traits< ReturnType(ClassType::*)(Arguments...) const - > { - typedef ReturnType result_type; - - template - using argument = typename std::tuple_element< - Index, - std::tuple - >::type; - - static const std::size_t arity = sizeof...(Arguments); - }; + > : function_traits { }; /* support the non-const operator () * this will work with user defined functors */ @@ -41,6 +31,14 @@ namespace sqlite { > struct function_traits< ReturnType(ClassType::*)(Arguments...) + > : function_traits { }; + + template < + typename ReturnType, + typename... Arguments + > + struct function_traits< + ReturnType(*)(Arguments...) > { typedef ReturnType result_type; diff --git a/tests/functions.cc b/tests/functions.cc index f1fb073b..ef8b1e28 100644 --- a/tests/functions.cc +++ b/tests/functions.cc @@ -5,6 +5,9 @@ using namespace sqlite; using namespace std; +int add_integers(int i, int j) { + return i+j; +} int main() { try @@ -13,7 +16,7 @@ int main() db.define("my_new_concat", [](std::string i, std::string j) {return i+j;}); db.define("my_new_concat", [](std::string i, std::string j, std::string k) {return i+j+k;}); - db.define("add_integers", [](int i, int j) {return i+j;}); + db.define("add_integers", &add_integers); std::string test1, test3; int test2 = 0; db << "select my_new_concat('Hello ','world!')" >> test1;