diff --git a/examples/src/attributes.cpp b/examples/src/attributes.cpp index 4aeaef2..310ee68 100644 --- a/examples/src/attributes.cpp +++ b/examples/src/attributes.cpp @@ -26,12 +26,13 @@ static_assert(utempl::GetAttributes() == struct SomeOtherStruct { static_assert(utempl::OpenStruct()); - utempl::FieldAttribute field1; + utempl::FieldAttribute> field1; utempl::FieldAttribute field2; - utempl::FieldAttribute field3; + utempl::FieldAttribute> field3; static_assert(utempl::CloseStruct()); }; -static_assert(utempl::GetAttributes() == utempl::Tuple{utempl::kTypeList, utempl::NoInfo{}, utempl::kTypeList}); +static_assert(utempl::GetAttributes() == + utempl::Tuple{utempl::kTypeList, utempl::kTypeList<>, utempl::kTypeList}); auto main() -> int {}; diff --git a/src/attributes.cpp b/src/attributes.cpp index 36186b4..4756b80 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -35,25 +35,12 @@ export struct NoInfo { consteval auto operator==(const NoInfo&) const -> bool = default; }; -template -struct FieldAttributeData { - using Type = TypeList; -}; - -template <> -struct FieldAttributeData<> { - using Type = NoInfo; -}; - -template ())::Type, - auto = AddTypeToTag, typename FieldAttributeData::Type, decltype(f)>()> -consteval auto FieldAttributeHelper() -> T; - -export template -using FieldAttribute = decltype(FieldAttributeHelper()); +export template , + auto f = [] {}, + typename Current = decltype(GetCurrentTagType())::Type, + auto = AddTypeToTag, O, decltype(f)>()> +using FieldAttribute = T; export template , decltype(f)>() > 0)> concept HasAttributes = R; @@ -74,9 +61,10 @@ consteval auto GetAttributes() export template consteval auto GetAttributes() { constexpr auto I = loopholes::CountValue>(); - return [](auto... is) { - return utempl::Tuple{typename decltype(Magic(loopholes::Getter>{}>{}))::Type{}...}; - } | kSeq; + return + [](auto... is) -> Tuple>{}>{}))::Type...> { + return {}; + } | kSeq; }; } // namespace utempl