import std; import utempl.attributes; import utempl.type_list; #include template struct AttributeData { T value; constexpr auto operator==(const AttributeData&) const -> bool = default; }; #define MY_ATTRIBUTE(type, ...) GENERIC_ATTRIBUTE(AttributeData{__VA_ARGS__}) // NOLINT // clang-format off ATTRIBUTE_STRUCT(SomeStruct, MY_ATTRIBUTE(int, .value = 2); int field; SKIP_ATTRIBUTE(); int field2; MY_ATTRIBUTE(std::string, .value = "HEY!"); std::string field3; ); // clang-format on static_assert(utempl::GetAttributes() == utempl::Tuple{AttributeData{.value = 2}, utempl::NoInfo{}, AttributeData{.value = "HEY!"}}); struct SomeOtherStruct { static_assert(utempl::OpenStruct()); utempl::FieldAttribute field1; utempl::FieldAttribute field2; utempl::FieldAttribute field3; static_assert(utempl::CloseStruct()); }; static_assert(utempl::GetAttributes() == utempl::Tuple{utempl::kTypeList, utempl::NoInfo{}, utempl::kTypeList}); auto main() -> int {};