It really should be
Code:
template <typename... Args>
bool doesItThrow(Args&&... args)
{
try { m_Function(std::forward<Args>(args)...); }
catch (std::exception&) { return true; }
return false;
}
Look up perfect forwarding.
But really, you should be looking at the noexcept specifier:
Code:
void foo1() noexcept {}
void foo2() {}
void do_something(std::true_type) {} // If it was true
void do_something(std::false_type) {} // if it was false
int main()
{
do_something(std::integral_constant<bool, noexcept(foo1())>()); // Do static type dispatch
std::cout << "foo1: " << noexcept(foo2()) << "\n"; // Do print out boolean value (can be used in if statements)
return 0;
}