diff --git a/examples/src/attributes.cpp b/examples/src/attributes.cpp index e8ab25c..773e083 100644 --- a/examples/src/attributes.cpp +++ b/examples/src/attributes.cpp @@ -30,13 +30,15 @@ static_assert(utempl::GetAttributes() struct SomeOtherStruct { static_assert(utempl::OpenStruct()); utempl::FieldAttribute, int> field1; - utempl::FieldAttribute, void> field2; + utempl::FieldAttribute> field2; + utempl::FieldAttribute, void> field3; static_assert(utempl::CloseStruct()); }; static_assert(utempl::GetAttributes() == utempl::Tuple{ utempl::kTypeList, + utempl::NoInfo{}, utempl::kTypeList}); diff --git a/include/utempl/attributes.hpp b/include/utempl/attributes.hpp index ba61492..ff27d63 100644 --- a/include/utempl/attributes.hpp +++ b/include/utempl/attributes.hpp @@ -56,12 +56,23 @@ struct FieldType { namespace impl { +template +struct FieldAttributeData { + using Type = TypeList; +}; + +template <> +struct FieldAttributeData<> { + using Type = NoInfo; +}; + + template < typename T, typename... Ts, auto f = []{}, typename Current = decltype(GetCurrentTagType())::Type, - auto = AddTypeToTag, TypeList, decltype(f)>() + auto = AddTypeToTag, typename FieldAttributeData::Type, decltype(f)>() > consteval auto FieldAttribute() -> T::Type;