template< typename T >
void addVarCB(const std::string &name,
TwSetVarCallback setCallback, TwGetVarCallback getCallback,
void * clientData, const std::string &def = "" );
template< class C, typename T >
void addVarCB(const std::string &name,
C * _this, T(C::*getter)(void), const std::string &def = "");
The following code will compile and crash on runtime:
bar_->addVarCB<MyClass, unsigned>("foo", this, &MyClass::MyClassFn, nullptr);
I would actually expect it NOT to compile at all, as there is no function that takes its parameters as an argument! (note that “MyClass, unsigned” is unnecessary but just to be clear…)
Sadly,
std::stringis constructible fromnullptr, see here, specifically(5):Note: