mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #1019 from asuessenbach/hash
Introduce struct hash<vk::Flags<BitType>>
This commit is contained in:
commit
4e84774ab6
@ -409,7 +409,17 @@ std::string VulkanHppGenerator::generateHashStructures() const
|
|||||||
${hashes}
|
${hashes}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
std::string hashes;
|
// start with the hash on Flags<BitType>
|
||||||
|
std::string hashes = R"(
|
||||||
|
template <typename BitType> struct hash<VULKAN_HPP_NAMESPACE::Flags<BitType>>
|
||||||
|
{
|
||||||
|
std::size_t operator()(VULKAN_HPP_NAMESPACE::Flags<BitType> const& flags) const VULKAN_HPP_NOEXCEPT
|
||||||
|
{
|
||||||
|
return std::hash<typename std::underlying_type<BitType>::type>{}(static_cast<typename std::underlying_type<BitType>::type>(flags));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
)";
|
||||||
|
|
||||||
for ( auto const & feature : m_features )
|
for ( auto const & feature : m_features )
|
||||||
{
|
{
|
||||||
hashes += generateHashStructures( feature.second.types, feature.first );
|
hashes += generateHashStructures( feature.second.types, feature.first );
|
||||||
|
@ -13263,6 +13263,16 @@ namespace std
|
|||||||
//=== HASH structures ===
|
//=== HASH structures ===
|
||||||
//=======================
|
//=======================
|
||||||
|
|
||||||
|
template <typename BitType>
|
||||||
|
struct hash<VULKAN_HPP_NAMESPACE::Flags<BitType>>
|
||||||
|
{
|
||||||
|
std::size_t operator()( VULKAN_HPP_NAMESPACE::Flags<BitType> const & flags ) const VULKAN_HPP_NOEXCEPT
|
||||||
|
{
|
||||||
|
return std::hash<typename std::underlying_type<BitType>::type>{}(
|
||||||
|
static_cast<typename std::underlying_type<BitType>::type>( flags ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//=== VK_VERSION_1_0 ===
|
//=== VK_VERSION_1_0 ===
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
Loading…
Reference in New Issue
Block a user