C++ Logo

SG7

Advanced search

Subject: P1887R0 attribute predicades
From: Cleiton Santoia (cleitonsantoia_at_[hidden])
Date: 2020-11-10 08:22:20


namespace std::meta {
  template consteval <typename Attr> // Need to be a template ?
  bool has_attribute(info x);

  template consteval <typename Attr> // template parameter only in result ?
  Attr attribute(info x);
}

Given:

public X {};
public Y { Y(int) {} };

[[X]]
struct V {};
[[Y(10)]]
struct W {};

constexpr auto x = std::meta::attribute<X>(reflexpr(V)); // ok x = X();
constexpr auto y = std::meta::attribute<Y>(reflexpr(W)); // ok y = Y(10);

but what if you ask for

constexpr auto y2 = std::meta::attribute<Y>(reflexpr(V)); ???

since Y cannot be default initialized ?

I believe std::meta::attribute should a plural filtered funcion

template consteval
std::vector<info> attributes_of( info class_type, Args ...filters );



SG7 list run by sg7-owner@lists.isocpp.org

Older Archives on Google Groups