mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Add helper function to copy a vector of UniqueHandles into a vector of UniqueHandle::element_type. (#327)
This commit is contained in:
parent
ac10dafd73
commit
d566d2200c
@ -4604,8 +4604,8 @@ int main( int argc, char **argv )
|
||||
{
|
||||
private:
|
||||
using Deleter = typename UniqueHandleTraits<Type,Dispatch>::deleter;
|
||||
public:
|
||||
|
||||
public:
|
||||
using element_type = Type;
|
||||
|
||||
explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() )
|
||||
@ -4695,6 +4695,14 @@ int main( int argc, char **argv )
|
||||
Type m_value;
|
||||
};
|
||||
|
||||
template <typename UniqueType>
|
||||
VULKAN_HPP_INLINE std::vector<typename UniqueType::element_type> uniqueToRaw(std::vector<UniqueType> const& handles)
|
||||
{
|
||||
std::vector<typename UniqueType::element_type> newBuffer(handles.size());
|
||||
std::transform(handles.begin(), handles.end(), newBuffer.begin(), [](UniqueType const& handle) { return handle.get(); });
|
||||
return newBuffer;
|
||||
}
|
||||
|
||||
template <typename Type, typename Dispatch>
|
||||
VULKAN_HPP_INLINE void swap( UniqueHandle<Type,Dispatch> & lhs, UniqueHandle<Type,Dispatch> & rhs )
|
||||
{
|
||||
|
@ -508,8 +508,8 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
private:
|
||||
using Deleter = typename UniqueHandleTraits<Type,Dispatch>::deleter;
|
||||
public:
|
||||
|
||||
public:
|
||||
using element_type = Type;
|
||||
|
||||
explicit UniqueHandle( Type const& value = Type(), Deleter const& deleter = Deleter() )
|
||||
@ -599,6 +599,14 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
Type m_value;
|
||||
};
|
||||
|
||||
template <typename UniqueType>
|
||||
VULKAN_HPP_INLINE std::vector<typename UniqueType::element_type> uniqueToRaw(std::vector<UniqueType> const& handles)
|
||||
{
|
||||
std::vector<typename UniqueType::element_type> newBuffer(handles.size());
|
||||
std::transform(handles.begin(), handles.end(), newBuffer.begin(), [](UniqueType const& handle) { return handle.get(); });
|
||||
return newBuffer;
|
||||
}
|
||||
|
||||
template <typename Type, typename Dispatch>
|
||||
VULKAN_HPP_INLINE void swap( UniqueHandle<Type,Dispatch> & lhs, UniqueHandle<Type,Dispatch> & rhs )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user