except: automatically detect ValueT for try_value
This commit is contained in:
parent
d2472e229c
commit
acedac53d0
13
except.hpp
13
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 <typename ValueT, typename FuncT, typename ...Args>
|
||||
static ValueT
|
||||
template <typename FuncT, typename ...Args>
|
||||
static auto
|
||||
try_query (FuncT &&func, Args &&...args)
|
||||
{
|
||||
using ValueT = std::remove_pointer_t<
|
||||
std::tuple_element_t<
|
||||
sizeof... (Args),
|
||||
typename func_traits<FuncT>::argument_types
|
||||
>
|
||||
>;
|
||||
|
||||
ValueT value;
|
||||
try_func (func, std::forward<Args> (args)..., &value);
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user