From d88ecaf6133232a1fb1938527dfbe8bf51d530a6 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 1 Sep 2017 12:33:08 +1000 Subject: [PATCH] traits: add structure_type trait for native types --- traits.hpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/traits.hpp b/traits.hpp index 67975b8..4caf953 100644 --- a/traits.hpp +++ b/traits.hpp @@ -12,7 +12,7 @@ * limitations under the License. * * Copyright: - * 2016, Danny Robson + * 2016-2017, Danny Robson */ #ifndef CRUFT_VK_TRAITS_HPP @@ -21,7 +21,32 @@ #include "./fwd.hpp" #include "./vk.hpp" +#include + + namespace cruft::vk { + /// describes the corresponding value for sType in native structures + template + struct structure_type {}; + + + //------------------------------------------------------------------------- + #define DEFINE_STRUCTURE_TYPE(KLASS,VALUE) \ + template <> \ + struct structure_type : \ + public std::integral_constant \ + { } + + DEFINE_STRUCTURE_TYPE (VkInstanceCreateInfo, VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO); + + #undef DEFINE_STRUCTURE_TYPE + + + //------------------------------------------------------------------------- + template + constexpr auto structure_type_v = structure_type::value; + + /////////////////////////////////////////////////////////////////////////// template struct id_traits { };