Checking status codes of VkHpp functions

When I was using the C API, I wrote a function called ck that receives status codes from functions:

ck(vkCreateInstance(&instance_info, NULL, &ctx->instance));

I’d like to write a similar function for VkHpp:

instance = ck(vk::createInstance(instInfo));

The problem is that VkHpp’s functions return a ResultValueType if VULKAN_HPP_NO_EXCEPTIONS is defined. Here’s the prototype of my function:


template<typename T>
T ck(vk::ResultValueType<T> result);

But the compiler doesn’t appreciate my use of vk::ResultValueType. Any ideas on how to fix it?

But the compiler doesn’t appreciate my use of vk::ResultValueType.

Why doesn’t it? I’m sure the compiler says something about it. So what does it say?

The compiler’s response is:

No matching function for call to ‘ck(vk::ResultValueType<vk::Instance>::type)’
   instance = ck(vk::createInstance(instInfo));

Template argument deduction/substitution failed:
‘vk::Instance’ is not derived from ‘vk::ResultValueType<T>’
   instance = ck(vk::createInstance(instInfo));

The compiler can’t replace T with vk::Instance because it needs to know T’s type in advance.

Has anyone else tried to check for errors in Vulkan-Hpp code?