return true;
return false;
}
-
-constexpr bool is_identifier_continue(char ch) noexcept
-{
- return is_identifier_start(ch) || is_digit(ch);
-}
}
std::string Generator::get_enumerant_name(const char *enumeration_name,
case ast::Operand_kinds::Operand_kind::Category::literal:
{
auto &doc = util::get<ast::Operand_kinds::Operand_kind::Doc>(operand_kind->value);
+ auto literal_kind =
+ ast::Operand_kinds::Operand_kind::get_literal_kind_from_json_name(
+ operand_kind->kind);
+ if(!literal_kind)
+ throw Generate_error("bad literal kind");
auto base_type = "std::vector<Word>";
- if(operand_kind->kind == "LiteralInteger")
- base_type = "std::uint32_t"; // TODO: fix after determining if LiteralInteger
- // can be multiple words
- else if(operand_kind->kind == "LiteralString")
+ switch(*literal_kind)
+ {
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_integer:
+ // TODO: fix after determining if LiteralInteger can be multiple words
+ base_type = "std::uint32_t";
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_string:
base_type = "std::string";
- else if(operand_kind->kind == "LiteralExtInstInteger")
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::
+ literal_context_dependent_number:
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_ext_inst_integer:
base_type = "Word";
- else if(operand_kind->kind == "LiteralSpecConstantOpInteger")
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::
+ literal_spec_constant_op_integer:
base_type = "Op";
-#warning finish
+ break;
+ }
state << "\n"
"/** ";
bool was_last_star = false;
}
state << "};\n";
}
-
-#warning finish
write_namespaces_end(state, spirv_namespace_names);
write_file_guard_end(state);
}
state << indent("virtual void handle_instruction(") << struct_name
<< " instruction) = 0;\n";
}
-#warning finish
}
state << indent(R"(};
state << indent("void ") << dump_function_name << "(const std::vector<"
<< get_operand_with_parameters_name(state, operand_kind) << "> &values);\n";
}
-#warning finish
}
state << "};\n"
"\n"
}
case ast::Operand_kinds::Operand_kind::Category::literal:
{
- if(operand_kind.kind == "LiteralInteger")
+ auto literal_kind =
+ ast::Operand_kinds::Operand_kind::get_literal_kind_from_json_name(
+ operand_kind.kind);
+ if(!literal_kind)
+ throw Generate_error("bad literal kind");
+ switch(*literal_kind)
{
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_integer:
// TODO: fix after determining if LiteralInteger can be multiple words
state << indent(R"(value = words[word_index++];
)");
- }
- else if(operand_kind.kind == "LiteralExtInstInteger")
- {
- state << indent(R"(value = words[word_index++];
-)");
- }
- else if(operand_kind.kind == "LiteralString")
- {
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_string:
state << indent(
R"(value.clear();
bool done = false;
`}
}
)");
- }
- else if(operand_kind.kind == "LiteralSpecConstantOpInteger")
- {
-#warning finish
- state << indent(R"(value = static_cast<)") << op_enum_name
- << indent(true, R"(>(words[word_index++]);
-)");
- }
- else
- {
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::
+ literal_context_dependent_number:
state << indent(
R"(static_assert(std::is_same<decltype(value), std::vector<Word> &>::value, "missing parse code for operand kind");
value.clear();
while(word_index < word_count)
`value.push_back(words[word_index++]);
)");
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_ext_inst_integer:
+ state << indent(R"(value = words[word_index++];
+)");
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::
+ literal_spec_constant_op_integer:
+ state << indent(R"(value = static_cast<)") << op_enum_name
+ << indent(true, R"(>(words[word_index++]);
+)");
+ break;
}
break;
}
`return nullptr;
}
)");
-#warning finish
}
state << "};\n";
-#warning finish
write_namespaces_end(state, spirv_namespace_names);
write_file_guard_end(state);
}
state << indent(2)
<< Parser_header_generator::get_dump_operand_function_name(
parameter)
- << "(parameters->" << get_member_name_from_parameter(parameter)
- << ");\n";
+ << "(parameters->"
+ << get_member_name_from_parameter(parameter) << ");\n";
}
state << indent(R"a(`}
`os << ")";
}
case ast::Operand_kinds::Operand_kind::Category::literal:
{
- if(operand_kind.kind == "LiteralInteger")
+ auto literal_kind =
+ ast::Operand_kinds::Operand_kind::get_literal_kind_from_json_name(
+ operand_kind.kind);
+ if(!literal_kind)
+ throw Generate_error("bad literal kind");
+ switch(*literal_kind)
{
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_integer:
state << indent(
R"(os << json::ast::Number_value::append_unsigned_integer_to_string(value, "0x");
)");
- }
- else if(operand_kind.kind == "LiteralExtInstInteger")
- {
- state << indent(
- R"(os << json::ast::Number_value::append_unsigned_integer_to_string(value, "0x");
-)");
- }
- else if(operand_kind.kind == "LiteralString")
- {
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_string:
state << indent(
R"(json::ast::String_value::write(os, value);
)");
- }
- else if(operand_kind.kind == "LiteralSpecConstantOpInteger")
- {
- state << indent(R"(if(util::Enum_traits<)") << op_enum_name
- << indent(true, R"(>::find_value(value) == util::Enum_traits<)")
- << op_enum_name << indent(true, R"(>::npos)
-`os << json::ast::Number_value::unsigned_integer_to_string(static_cast<Word>(value));
-else
-`os << get_enumerant_name(value);
-)");
- }
- else
- {
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::
+ literal_context_dependent_number:
state << indent(
R"(static_assert(std::is_same<decltype(value), const std::vector<Word> &>::value, "missing dump code for operand kind");
auto separator = "";
}
os << "}";
)");
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::literal_ext_inst_integer:
+ state << indent(
+ R"(os << json::ast::Number_value::append_unsigned_integer_to_string(value, "0x");
+)");
+ break;
+ case ast::Operand_kinds::Operand_kind::Literal_kind::
+ literal_spec_constant_op_integer:
+ state << indent(R"(if(util::Enum_traits<)") << op_enum_name
+ << indent(true, R"(>::find_value(value) == util::Enum_traits<)")
+ << op_enum_name << indent(true, R"(>::npos)
+`os << json::ast::Number_value::unsigned_integer_to_string(static_cast<Word>(value));
+else
+`os << get_enumerant_name(value);
+)");
+ break;
}
break;
}
constexpr bool variant_is_trivially_destructible() noexcept
{
bool values[] = {
- std::is_trivially_destructible<Types>::value...,
+ true, std::is_trivially_destructible<Types>::value...,
};
for(bool v : values)
if(!v)
using Variant_values =
Variant_values_implementation<variant_is_trivially_destructible<Types...>(), Types...>;
-#define VULKAN_CPU_UTIL_VARIANT_VALUES(Is_Trivially_Destructible, Destructor) \
- template <typename T, typename... Types> \
- union Variant_values_implementation<Is_Trivially_Destructible, T, Types...> \
- { \
- typedef T Type_0; \
- static_assert(!std::is_void<T>::value, "invalid variant member type"); \
- static_assert(!std::is_reference<T>::value, "invalid variant member type"); \
- static_assert(!std::is_array<T>::value, "invalid variant member type"); \
- static_assert(!std::is_const<T>::value, "invalid variant member type"); \
- static_assert(!std::is_volatile<T>::value, "invalid variant member type"); \
- static_assert(std::is_object<T>::value, "invalid variant member type"); \
- T current_value; \
- Variant_values_implementation<Is_Trivially_Destructible, Types...> other_values; \
- static constexpr bool is_copy_constructible = \
- std::is_copy_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_copy_constructible; \
- static constexpr bool is_move_constructible = \
- std::is_move_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_move_constructible; \
- static constexpr bool is_nothrow_copy_constructible = \
- std::is_nothrow_copy_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_nothrow_copy_constructible; \
- static constexpr bool is_nothrow_move_constructible = \
- std::is_nothrow_move_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_nothrow_move_constructible; \
- static constexpr bool is_copy_assignable = \
- std::is_copy_assignable<T>::value && std::is_copy_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_copy_assignable; \
- static constexpr bool is_move_assignable = \
- std::is_move_assignable<T>::value && std::is_move_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_move_assignable; \
- static constexpr bool is_nothrow_copy_assignable = \
- std::is_nothrow_copy_assignable<T>::value \
- && std::is_nothrow_copy_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_nothrow_copy_assignable; \
- static constexpr bool is_nothrow_move_assignable = \
- std::is_nothrow_move_assignable<T>::value \
- && std::is_nothrow_move_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_nothrow_move_assignable; \
- static constexpr bool is_swappable = \
- is_swappable_v<T> && std::is_move_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, Types...>::is_swappable; \
- static constexpr bool is_nothrow_swappable = \
- is_nothrow_swappable_v<T> && std::is_nothrow_move_constructible<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_nothrow_swappable; \
- static constexpr bool is_equals_comparable = \
- Variant_is_equals_comparable<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_equals_comparable; \
- static constexpr bool is_less_comparable = \
- Variant_is_less_comparable<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_less_comparable; \
- static constexpr bool is_nothrow_equals_comparable = \
- Variant_is_nothrow_equals_comparable<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_nothrow_equals_comparable; \
- static constexpr bool is_nothrow_less_comparable = \
- Variant_is_nothrow_less_comparable<T>::value \
- && Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::is_nothrow_less_comparable; \
- template < \
- typename T2 = T, \
- typename = typename std::enable_if<std::is_default_constructible<T2>::value>::type> \
- constexpr Variant_values_implementation() noexcept( \
- std::is_nothrow_default_constructible<T2>::value) \
- : current_value() \
- { \
- } \
- template < \
- typename... Args, \
- typename = typename std::enable_if<std::is_constructible<T, Args...>::value>::type> \
- constexpr Variant_values_implementation(in_place_index_t<0>, Args &&... args) noexcept( \
- std::is_nothrow_constructible<T, Args...>::value) \
- : current_value(std::forward<Args>(args)...) \
- { \
- } \
- template <std::size_t index, \
- typename... Args, \
- typename = typename std:: \
- enable_if<index != 0 \
- && std:: \
- is_constructible<Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>, \
- in_place_index_t<index - 1>, \
- Args...>::value>::type> \
- constexpr Variant_values_implementation(in_place_index_t<index>, Args &&... args) noexcept( \
- std::is_nothrow_constructible<Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>, \
- in_place_index_t<index - 1>, \
- Args...>::value) \
- : other_values(in_place_index<index - 1>, std::forward<Args>(args)...) \
- { \
- } \
- template < \
- typename U, \
- typename... Args, \
- typename = typename std::enable_if<std::is_constructible<T, \
- std::initializer_list<U>, \
- Args...>::value>::type> \
- constexpr Variant_values_implementation( \
- in_place_index_t<0>, \
- std::initializer_list<U> il, \
- Args &&... args) noexcept(std::is_nothrow_constructible<T, \
- std::initializer_list<U>, \
- Args...>::value) \
- : current_value(il, std::forward<Args>(args)...) \
- { \
- } \
- template <typename U> \
- static constexpr std::size_t index_from_type() noexcept \
- { \
- std::size_t next = \
- Variant_values_implementation<Is_Trivially_Destructible, \
- Types...>::template index_from_type<U>(); \
- if(std::is_same<U, T>::value && next == variant_npos) \
- return 0; \
- if(next == variant_npos) \
- return variant_npos; \
- return next + 1; \
- } \
- void copy_construct(const Variant_values_implementation &rt, \
- std::size_t index) noexcept(is_nothrow_copy_constructible) \
- { \
- if(index == 0) \
- new(const_cast<void *>(static_cast<const volatile void *>( \
- std::addressof(current_value)))) T(rt.current_value); \
- else \
- other_values.copy_construct(rt.other_values, index - 1); \
- } \
- void move_construct(Variant_values_implementation &&rt, \
- std::size_t index) noexcept(is_nothrow_move_constructible) \
- { \
- if(index == 0) \
- new(const_cast<void *>(static_cast<const volatile void *>( \
- std::addressof(current_value)))) T(std::move(rt.current_value)); \
- else \
- other_values.move_construct(std::move(rt.other_values), index - 1); \
- } \
- void copy_assign(const Variant_values_implementation &rt, \
- std::size_t index) noexcept(is_nothrow_copy_assignable) \
- { \
- if(index == 0) \
- current_value = rt.current_value; \
- else \
- other_values.copy_assign(rt.other_values, index - 1); \
- } \
- void move_assign(Variant_values_implementation &&rt, \
- std::size_t index) noexcept(is_nothrow_move_assignable) \
- { \
- if(index == 0) \
- current_value = std::move(rt.current_value); \
- else \
- other_values.move_assign(std::move(rt.other_values), index - 1); \
- } \
- void destruct(std::size_t index) noexcept \
- { \
- if(index == 0) \
- current_value.~T(); \
- else \
- other_values.destruct(index - 1); \
- } \
- void swap(Variant_values_implementation &rt, \
- std::size_t index) noexcept(is_nothrow_swappable) \
- { \
- using std::swap; \
- if(index == 0) \
- swap(current_value, rt.current_value); \
- else \
- other_values.swap(rt.other_values, index - 1); \
- } \
- bool is_equal(const Variant_values_implementation &rt, std::size_t index) const \
- noexcept(is_nothrow_equals_comparable) \
- { \
- if(index == 0) \
- return static_cast<bool>(current_value == rt.current_value); \
- return other_values.is_equal(rt.other_values, index - 1); \
- } \
- bool is_less(const Variant_values_implementation &rt, std::size_t index) const \
- noexcept(is_nothrow_less_comparable) \
- { \
- if(index == 0) \
- return static_cast<bool>(current_value < rt.current_value); \
- return other_values.is_equal(rt.other_values, index - 1); \
- } \
- Destructor \
+#define VULKAN_CPU_UTIL_VARIANT_VALUES(Is_Trivially_Destructible, Destructor) \
+ template <typename T, typename... Types> \
+ union Variant_values_implementation<Is_Trivially_Destructible, T, Types...> \
+ { \
+ typedef T Type_0; \
+ static_assert(!std::is_void<T>::value, "invalid variant member type"); \
+ static_assert(!std::is_reference<T>::value, "invalid variant member type"); \
+ static_assert(!std::is_array<T>::value, "invalid variant member type"); \
+ static_assert(!std::is_const<T>::value, "invalid variant member type"); \
+ static_assert(!std::is_volatile<T>::value, "invalid variant member type"); \
+ static_assert(std::is_object<T>::value, "invalid variant member type"); \
+ T current_value; \
+ Variant_values<Types...> other_values; \
+ static constexpr bool is_copy_constructible = \
+ std::is_copy_constructible<T>::value \
+ && Variant_values<Types...>::is_copy_constructible; \
+ static constexpr bool is_move_constructible = \
+ std::is_move_constructible<T>::value \
+ && Variant_values<Types...>::is_move_constructible; \
+ static constexpr bool is_nothrow_copy_constructible = \
+ std::is_nothrow_copy_constructible<T>::value \
+ && Variant_values<Types...>::is_nothrow_copy_constructible; \
+ static constexpr bool is_nothrow_move_constructible = \
+ std::is_nothrow_move_constructible<T>::value \
+ && Variant_values<Types...>::is_nothrow_move_constructible; \
+ static constexpr bool is_copy_assignable = \
+ std::is_copy_assignable<T>::value && std::is_copy_constructible<T>::value \
+ && Variant_values<Types...>::is_copy_assignable; \
+ static constexpr bool is_move_assignable = \
+ std::is_move_assignable<T>::value && std::is_move_constructible<T>::value \
+ && Variant_values<Types...>::is_move_assignable; \
+ static constexpr bool is_nothrow_copy_assignable = \
+ std::is_nothrow_copy_assignable<T>::value \
+ && std::is_nothrow_copy_constructible<T>::value \
+ && Variant_values<Types...>::is_nothrow_copy_assignable; \
+ static constexpr bool is_nothrow_move_assignable = \
+ std::is_nothrow_move_assignable<T>::value \
+ && std::is_nothrow_move_constructible<T>::value \
+ && Variant_values<Types...>::is_nothrow_move_assignable; \
+ static constexpr bool is_swappable = \
+ is_swappable_v<T> && std::is_move_constructible<T>::value \
+ && Variant_values<Types...>::is_swappable; \
+ static constexpr bool is_nothrow_swappable = \
+ is_nothrow_swappable_v<T> && std::is_nothrow_move_constructible<T>::value \
+ && Variant_values<Types...>::is_nothrow_swappable; \
+ static constexpr bool is_equals_comparable = \
+ Variant_is_equals_comparable<T>::value \
+ && Variant_values<Types...>::is_equals_comparable; \
+ static constexpr bool is_less_comparable = \
+ Variant_is_less_comparable<T>::value && Variant_values<Types...>::is_less_comparable; \
+ static constexpr bool is_nothrow_equals_comparable = \
+ Variant_is_nothrow_equals_comparable<T>::value \
+ && Variant_values<Types...>::is_nothrow_equals_comparable; \
+ static constexpr bool is_nothrow_less_comparable = \
+ Variant_is_nothrow_less_comparable<T>::value \
+ && Variant_values<Types...>::is_nothrow_less_comparable; \
+ template < \
+ typename T2 = T, \
+ typename = typename std::enable_if<std::is_default_constructible<T2>::value>::type> \
+ constexpr Variant_values_implementation() noexcept( \
+ std::is_nothrow_default_constructible<T2>::value) \
+ : current_value() \
+ { \
+ } \
+ template < \
+ typename... Args, \
+ typename = typename std::enable_if<std::is_constructible<T, Args...>::value>::type> \
+ constexpr Variant_values_implementation(in_place_index_t<0>, Args &&... args) noexcept( \
+ std::is_nothrow_constructible<T, Args...>::value) \
+ : current_value(std::forward<Args>(args)...) \
+ { \
+ } \
+ template <std::size_t index, \
+ typename... Args, \
+ typename = typename std:: \
+ enable_if<index != 0 && std::is_constructible<Variant_values<Types...>, \
+ in_place_index_t<index - 1>, \
+ Args...>::value>::type> \
+ constexpr Variant_values_implementation( \
+ in_place_index_t<index>, \
+ Args &&... args) noexcept(std::is_nothrow_constructible<Variant_values<Types...>, \
+ in_place_index_t<index - 1>, \
+ Args...>::value) \
+ : other_values(in_place_index<index - 1>, std::forward<Args>(args)...) \
+ { \
+ } \
+ template < \
+ typename U, \
+ typename... Args, \
+ typename = typename std::enable_if<std::is_constructible<T, \
+ std::initializer_list<U>, \
+ Args...>::value>::type> \
+ constexpr Variant_values_implementation( \
+ in_place_index_t<0>, \
+ std::initializer_list<U> il, \
+ Args &&... args) noexcept(std::is_nothrow_constructible<T, \
+ std::initializer_list<U>, \
+ Args...>::value) \
+ : current_value(il, std::forward<Args>(args)...) \
+ { \
+ } \
+ template <typename U> \
+ static constexpr std::size_t index_from_type() noexcept \
+ { \
+ std::size_t next = Variant_values<Types...>::template index_from_type<U>(); \
+ if(std::is_same<U, T>::value && next == variant_npos) \
+ return 0; \
+ if(next == variant_npos) \
+ return variant_npos; \
+ return next + 1; \
+ } \
+ void copy_construct(const Variant_values_implementation &rt, \
+ std::size_t index) noexcept(is_nothrow_copy_constructible) \
+ { \
+ if(index == 0) \
+ new(const_cast<void *>(static_cast<const volatile void *>( \
+ std::addressof(current_value)))) T(rt.current_value); \
+ else \
+ other_values.copy_construct(rt.other_values, index - 1); \
+ } \
+ void move_construct(Variant_values_implementation &&rt, \
+ std::size_t index) noexcept(is_nothrow_move_constructible) \
+ { \
+ if(index == 0) \
+ new(const_cast<void *>(static_cast<const volatile void *>( \
+ std::addressof(current_value)))) T(std::move(rt.current_value)); \
+ else \
+ other_values.move_construct(std::move(rt.other_values), index - 1); \
+ } \
+ void copy_assign(const Variant_values_implementation &rt, \
+ std::size_t index) noexcept(is_nothrow_copy_assignable) \
+ { \
+ if(index == 0) \
+ current_value = rt.current_value; \
+ else \
+ other_values.copy_assign(rt.other_values, index - 1); \
+ } \
+ void move_assign(Variant_values_implementation &&rt, \
+ std::size_t index) noexcept(is_nothrow_move_assignable) \
+ { \
+ if(index == 0) \
+ current_value = std::move(rt.current_value); \
+ else \
+ other_values.move_assign(std::move(rt.other_values), index - 1); \
+ } \
+ void destruct(std::size_t index) noexcept \
+ { \
+ if(index == 0) \
+ current_value.~T(); \
+ else \
+ other_values.destruct(index - 1); \
+ } \
+ void swap(Variant_values_implementation &rt, \
+ std::size_t index) noexcept(is_nothrow_swappable) \
+ { \
+ using std::swap; \
+ if(index == 0) \
+ swap(current_value, rt.current_value); \
+ else \
+ other_values.swap(rt.other_values, index - 1); \
+ } \
+ bool is_equal(const Variant_values_implementation &rt, std::size_t index) const \
+ noexcept(is_nothrow_equals_comparable) \
+ { \
+ if(index == 0) \
+ return static_cast<bool>(current_value == rt.current_value); \
+ return other_values.is_equal(rt.other_values, index - 1); \
+ } \
+ bool is_less(const Variant_values_implementation &rt, std::size_t index) const \
+ noexcept(is_nothrow_less_comparable) \
+ { \
+ if(index == 0) \
+ return static_cast<bool>(current_value < rt.current_value); \
+ return other_values.is_equal(rt.other_values, index - 1); \
+ } \
+ Destructor \
};
VULKAN_CPU_UTIL_VARIANT_VALUES(true, ~Variant_values_implementation() = default;)
template <std::size_t Index, typename... Types>
struct Variant_get;
+template <typename T, typename... Types>
+struct Variant_get<0, T, Types...>
+{
+ static constexpr const T &get(const Variant_values<T, Types...> &values) noexcept
+ {
+ return values.current_value;
+ }
+ static constexpr T &get(Variant_values<T, Types...> &values) noexcept
+ {
+ return values.current_value;
+ }
+ static constexpr const T &&get(const Variant_values<T, Types...> &&values) noexcept
+ {
+ return std::move(values.current_value);
+ }
+ static constexpr T &&get(Variant_values<T, Types...> &&values) noexcept
+ {
+ return std::move(values.current_value);
+ }
+};
+
template <std::size_t Index, typename T, typename... Types>
struct Variant_get<Index, T, Types...>
{
}
};
-template <typename T, typename... Types>
-struct Variant_get<0, T, Types...>
-{
- static constexpr const T &get(const Variant_values<T, Types...> &values) noexcept
- {
- return values.current_value;
- }
- static constexpr T &get(Variant_values<T, Types...> &values) noexcept
- {
- return values.current_value;
- }
- static constexpr const T &&get(const Variant_values<T, Types...> &&values) noexcept
- {
- return std::move(values.current_value);
- }
- static constexpr T &&get(Variant_values<T, Types...> &&values) noexcept
- {
- return std::move(values.current_value);
- }
-};
-
#define VULKAN_CPU_UTIL_VARIANT_DISPATCH(Const, Ref) \
template <std::size_t Index, \
typename Return_Type, \