1

With tools such as std::is_base_of, std::is_arithmetic, etc, is there a way we can, at run time, check if a function is available to a type?

e.g.

template<typename T>
void function( T arg )
{
    static_assert(std::has_function<T, "DoSomething">::value, "Type must have function DoSomething!");
    arg.DoSomething();
}

Or something along those lines?

Ben
  • 1,816
  • 1
  • 20
  • 29

0 Answers0