Update Attributes
This commit is contained in:
parent
d367f13d7b
commit
af067d0db4
2 changed files with 15 additions and 2 deletions
|
@ -30,13 +30,15 @@ static_assert(utempl::GetAttributes<SomeStruct>()
|
||||||
struct SomeOtherStruct {
|
struct SomeOtherStruct {
|
||||||
static_assert(utempl::OpenStruct<SomeOtherStruct>());
|
static_assert(utempl::OpenStruct<SomeOtherStruct>());
|
||||||
utempl::FieldAttribute<utempl::FieldType<int>, int> field1;
|
utempl::FieldAttribute<utempl::FieldType<int>, int> field1;
|
||||||
utempl::FieldAttribute<utempl::FieldType<int>, void> field2;
|
utempl::FieldAttribute<utempl::FieldType<int>> field2;
|
||||||
|
utempl::FieldAttribute<utempl::FieldType<std::string>, void> field3;
|
||||||
static_assert(utempl::CloseStruct());
|
static_assert(utempl::CloseStruct());
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(utempl::GetAttributes<SomeOtherStruct>()
|
static_assert(utempl::GetAttributes<SomeOtherStruct>()
|
||||||
== utempl::Tuple{
|
== utempl::Tuple{
|
||||||
utempl::kTypeList<int>,
|
utempl::kTypeList<int>,
|
||||||
|
utempl::NoInfo{},
|
||||||
utempl::kTypeList<void>});
|
utempl::kTypeList<void>});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,23 @@ struct FieldType {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
|
template <typename... Ts>
|
||||||
|
struct FieldAttributeData {
|
||||||
|
using Type = TypeList<Ts...>;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct FieldAttributeData<> {
|
||||||
|
using Type = NoInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
typename T,
|
typename T,
|
||||||
typename... Ts,
|
typename... Ts,
|
||||||
auto f = []{},
|
auto f = []{},
|
||||||
typename Current = decltype(GetCurrentTagType<impl::AttributesTag, decltype(f)>())::Type,
|
typename Current = decltype(GetCurrentTagType<impl::AttributesTag, decltype(f)>())::Type,
|
||||||
auto = AddTypeToTag<impl::AttributesCounterTag<Current>, TypeList<Ts...>, decltype(f)>()
|
auto = AddTypeToTag<impl::AttributesCounterTag<Current>, typename FieldAttributeData<Ts...>::Type, decltype(f)>()
|
||||||
>
|
>
|
||||||
consteval auto FieldAttribute() -> T::Type;
|
consteval auto FieldAttribute() -> T::Type;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue