diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-10-18 19:50:21 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-10-18 19:50:21 +0100 |
commit | bf8edc374d0c199ae197c4939c059b84c6c8e24f (patch) | |
tree | 0d39a300976c84385ad6224bfec7e32b98625feb | |
parent | Add wrappers for binding anything that can be optional (pointer or optional t... (diff) | |
download | libdbpp-bf8edc374d0c199ae197c4939c059b84c6c8e24f.tar.bz2 libdbpp-bf8edc374d0c199ae197c4939c059b84c6c8e24f.tar.xz libdbpp-bf8edc374d0c199ae197c4939c059b84c6c8e24f.zip |
Add enable_if to catch some conversion madness
-rw-r--r-- | libdbpp/command.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libdbpp/command.h b/libdbpp/command.h index ae18158..8fbff4e 100644 --- a/libdbpp/command.h +++ b/libdbpp/command.h @@ -5,6 +5,7 @@ #include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/shared_ptr.hpp> #include <visibility.h> +#include <type_traits> #include "error.h" namespace DB { @@ -64,8 +65,9 @@ namespace DB { #define OPTWRAPPER(func) \ template<typename O> \ - inline void func(unsigned int i, const O & o) { \ - if (o) \ + inline typename std::enable_if<std::is_constructible<bool, const O &>::value>::type func(unsigned int i, const O & o) { \ + bool nn(o); \ + if (nn) \ func(i, *o); \ else \ bindNull(i); \ |