What is a good way to call a member function of template type? Will the below foo()
code only compile for types that have the bla()
function defined?
class A { void bla(); };
template<typename T>
void foo() {
T t;
t.bla();
}
int main() {
foo<A>();
return 0;
}
Can I use boost::enable_if
to only define this function for types that have a bla()
method? If yes, is that even a good idea? I imagine the idea of "concepts" (which I know nothing about) is possibly what needs to be used here.