diff --git a/except.hpp b/except.hpp index 3b8769e..f0272d5 100644 --- a/except.hpp +++ b/except.hpp @@ -64,13 +64,20 @@ namespace cruft::vk { } - /// requests a ValueT using a invokable FuncT with arguments + /// returns a ValueT using an invokable FuncT with arguments /// [Args..., &ValueT] and returns the result after testing for /// success. - template - static ValueT + template + static auto try_query (FuncT &&func, Args &&...args) { + using ValueT = std::remove_pointer_t< + std::tuple_element_t< + sizeof... (Args), + typename func_traits::argument_types + > + >; + ValueT value; try_func (func, std::forward (args)..., &value); return value;