diff --git a/hecl/include/hecl/TypedVariant.hpp b/hecl/include/hecl/TypedVariant.hpp index 6841332b7..146d463db 100644 --- a/hecl/include/hecl/TypedVariant.hpp +++ b/hecl/include/hecl/TypedVariant.hpp @@ -202,62 +202,67 @@ private: TypedVariantBigDNA(TypedVariant<_Types...> var) : TypedVariant<_Types...>(std::move(var)) {} }; -#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \ -template <> \ -template <> \ -inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::Read>(typename Read::StreamT & r) { \ - EnumType variant_type = {}; \ - Do::Read>(athena::io::PropId("variant_type"), variant_type, r); \ - static_cast&>(*this) = Build(variant_type); \ - visit([&](auto& var) { var.read(r); }); \ -} \ - \ -template <> \ -template <> \ -inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::Write>(typename Write::StreamT & w) { \ - visit([&](auto& var) { \ - using T = std::decay_t; \ - EnumType variant_type = T::variant_type(); \ - Do::Write>(athena::io::PropId("variant_type"), variant_type, w); \ - var.write(w); \ - }); \ -} \ - \ -template <> \ -template <> \ -inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::BinarySize>(typename BinarySize::StreamT & sz) { \ - visit([&](auto& var) { \ - using T = std::decay_t; \ - EnumType variant_type = T::variant_type(); \ - Do::BinarySize>(athena::io::PropId("variant_type"), variant_type, sz); \ - var.binarySize(sz); \ - }); \ -} \ -template <> \ -inline const char* hecl::TypedVariantBigDNA<__VA_ARGS__>::DNAType() { \ - return "hecl::TypedVariantBigDNA<" #__VA_ARGS__ ">"; \ -} +#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \ + template <> \ + template <> \ + inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::Read>( \ + typename Read::StreamT & r) { \ + EnumType variant_type = {}; \ + Do::Read>(athena::io::PropId("variant_type"), variant_type, r); \ + static_cast&>(*this) = Build(variant_type); \ + visit([&](auto& var) { var.read(r); }); \ + } \ + \ + template <> \ + template <> \ + inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::Write>( \ + typename Write::StreamT & w) { \ + visit([&](auto& var) { \ + using T = std::decay_t; \ + EnumType variant_type = T::variant_type(); \ + Do::Write>(athena::io::PropId("variant_type"), variant_type, w); \ + var.write(w); \ + }); \ + } \ + \ + template <> \ + template <> \ + inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::BinarySize>( \ + typename BinarySize::StreamT & sz) { \ + visit([&](auto& var) { \ + using T = std::decay_t; \ + EnumType variant_type = T::variant_type(); \ + Do::BinarySize>(athena::io::PropId("variant_type"), variant_type, sz); \ + var.binarySize(sz); \ + }); \ + } \ + template <> \ + inline const char* hecl::TypedVariantBigDNA<__VA_ARGS__>::DNAType() { \ + return "hecl::TypedVariantBigDNA<" #__VA_ARGS__ ">"; \ + } -#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA_YAML(...) \ -AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \ -template <> \ -template <> \ -inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::ReadYaml>(typename ReadYaml::StreamT & r) { \ - EnumType variant_type = {}; \ - Do::ReadYaml>(athena::io::PropId("variant_type"), variant_type, r); \ - static_cast&>(*this) = Build(variant_type); \ - visit([&](auto& var) { var.read(r); }); \ -} \ - \ -template <> \ -template <> \ -inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::WriteYaml>(typename WriteYaml::StreamT & w) { \ - visit([&](auto& var) { \ - using T = std::decay_t; \ - EnumType variant_type = T::variant_type(); \ - Do::WriteYaml>(athena::io::PropId("variant_type"), variant_type, w); \ - var.write(w); \ - }); \ -} +#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA_YAML(...) \ + AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \ + template <> \ + template <> \ + inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::ReadYaml>( \ + typename ReadYaml::StreamT & r) { \ + EnumType variant_type = {}; \ + Do::ReadYaml>(athena::io::PropId("variant_type"), variant_type, r); \ + static_cast&>(*this) = Build(variant_type); \ + visit([&](auto& var) { var.read(r); }); \ + } \ + \ + template <> \ + template <> \ + inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate::WriteYaml>( \ + typename WriteYaml::StreamT & w) { \ + visit([&](auto& var) { \ + using T = std::decay_t; \ + EnumType variant_type = T::variant_type(); \ + Do::WriteYaml>(athena::io::PropId("variant_type"), variant_type, w); \ + var.write(w); \ + }); \ + } }