Introduce new function StructureChain::isLinked<>()

This commit is contained in:
asuessenbach
2021-01-20 10:33:33 +01:00
parent b9ec269ab2
commit 2e2782448c
3 changed files with 55 additions and 4 deletions

View File

@@ -1043,6 +1043,28 @@ namespace VULKAN_HPP_NAMESPACE
return std::tie( get<T0>(), get<T1>(), get<Ts>()... );
}
template <typename ClassType, size_t Which = 0>
typename std::enable_if<
std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value &&
( Which == 0 ),
bool>::type
isLinked() const VULKAN_HPP_NOEXCEPT
{
return true;
}
template <typename ClassType, size_t Which = 0>
typename std::enable_if<
!std::is_same<ClassType, typename std::tuple_element<0, std::tuple<ChainElements...>>::type>::value ||
( Which != 0 ),
bool>::type
isLinked() const VULKAN_HPP_NOEXCEPT
{
static_assert( IsPartOfStructureChain<ClassType, ChainElements...>::valid,
"Can't unlink Structure that's not part of this StructureChain!" );
return isLinked( reinterpret_cast<VkBaseInStructure const *>( &get<ClassType, Which>() ) );
}
template <typename ClassType, size_t Which = 0>
void relink() VULKAN_HPP_NOEXCEPT
{
@@ -1106,10 +1128,10 @@ namespace VULKAN_HPP_NAMESPACE
Types...> : std::integral_constant<int, Index>
{};
bool isLinked( VkBaseInStructure const * pNext )
bool isLinked( VkBaseInStructure const * pNext ) const VULKAN_HPP_NOEXCEPT
{
VkBaseInStructure const * elementPtr = reinterpret_cast<VkBaseInStructure const *>(
&std::get<0>( static_cast<std::tuple<ChainElements...> &>( *this ) ) );
&std::get<0>( static_cast<std::tuple<ChainElements...> const &>( *this ) ) );
while ( elementPtr )
{
if ( elementPtr->pNext == pNext )