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 {
26
26
Functor (std::forward<Functor1>(functor)) {}
27
27
using Functor::operator ();
28
28
};
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
+ };
29
44
}
30
45
template <class Handler >
31
46
typename std::enable_if<!std::is_callable<Handler(const sqlite_exception&)>::value>::type
@@ -36,7 +51,7 @@ namespace sqlite {
36
51
template <class ...Handler>
37
52
typename std::enable_if<sizeof ...(Handler)>=2 >::type
38
53
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)...));
40
55
}
41
56
template <class Handler >
42
57
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