File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,21 @@ namespace sqlite {
2626 Functor (std::forward<Functor1>(functor)) {}
2727 using Functor::operator ();
2828 };
29+ template <class Functor >
30+ class WrapIntoFunctor : public Functor {
31+ public:
32+ template <class Functor1 >
33+ WrapIntoFunctor (Functor1 &&functor):
34+ Functor (std::forward<Functor1>(functor)) {}
35+ using Functor::operator ();
36+ };
37+ template <class ReturnType , class ...Arguments>
38+ class WrapIntoFunctor <ReturnType(*)(Arguments...)> {
39+ ReturnType (*ptr)(Arguments...);
40+ public:
41+ WrapIntoFunctor (ReturnType(*ptr)(Arguments...)): ptr(ptr) {}
42+ ReturnType operator ()(Arguments... arguments) { return (*ptr)(std::forward<Arguments>(arguments)...); }
43+ };
2944 }
3045 template <class Handler >
3146 typename std::enable_if<!std::is_callable<Handler(const sqlite_exception&)>::value>::type
@@ -36,7 +51,7 @@ namespace sqlite {
3651 template <class ...Handler>
3752 typename std::enable_if<sizeof ...(Handler)>=2 >::type
3853 error_log (Handler &&...handler) {
39- return error_log (detail::FunctorOverload<typename std::decay<Handler>::type...>(std::forward<Handler>(handler)...));
54+ return error_log (detail::FunctorOverload<detail::WrapIntoFunctor< typename std::decay<Handler>::type> ...>(std::forward<Handler>(handler)...));
4055 }
4156 template <class Handler >
4257 typename std::enable_if<!std::is_callable<Handler(const sqlite_exception&)>::value>::type
You can’t perform that action at this time.
0 commit comments