Merge pull request #737 from asuessenbach/asTuple

Introduce helper function ResultValue<UniqueHandle<Type, Dispatch>>::asTuple()
This commit is contained in:
Andreas Süßenbach 2020-09-16 10:01:29 +02:00 committed by GitHub
commit dd6eb12aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 7 deletions

View File

@ -9436,8 +9436,10 @@ namespace std
, value(std::move(v))
{}
Result result;
UniqueHandle<Type, Dispatch> value;
std::tuple<Result, UniqueHandle<Type, Dispatch>> asTuple()
{
return std::make_tuple( result, std::move( value ) );
}
# if !defined(VULKAN_HPP_DISABLE_IMPLICIT_RESULT_VALUE_CAST)
VULKAN_HPP_DEPRECATED("Implicit-cast operators on vk::ResultValue are deprecated. Explicitly access the value as member of ResultValue.")
@ -9452,6 +9454,9 @@ namespace std
return std::move(value);
}
# endif
Result result;
UniqueHandle<Type, Dispatch> value;
};
template <typename Type, typename Dispatch>

View File

@ -161,9 +161,11 @@ int main( int /*argc*/, char ** /*argv*/ )
renderPass.get() // renderPass
);
vk::ResultValue<vk::UniquePipeline> pipeline =
device->createGraphicsPipelineUnique( nullptr, graphicsPipelineCreateInfo );
switch ( pipeline.result )
vk::Result result;
vk::UniquePipeline pipeline;
std::tie( result, pipeline ) =
device->createGraphicsPipelineUnique( nullptr, graphicsPipelineCreateInfo ).asTuple();
switch ( result )
{
case vk::Result::eSuccess: break;
case vk::Result::ePipelineCompileRequiredEXT:

View File

@ -16369,8 +16369,10 @@ namespace VULKAN_HPP_NAMESPACE
, value( std::move( v ) )
{}
Result result;
UniqueHandle<Type, Dispatch> value;
std::tuple<Result, UniqueHandle<Type, Dispatch>> asTuple()
{
return std::make_tuple( result, std::move( value ) );
}
# if !defined( VULKAN_HPP_DISABLE_IMPLICIT_RESULT_VALUE_CAST )
VULKAN_HPP_DEPRECATED(
@ -16387,6 +16389,9 @@ namespace VULKAN_HPP_NAMESPACE
return std::move( value );
}
# endif
Result result;
UniqueHandle<Type, Dispatch> value;
};
template <typename Type, typename Dispatch>