9class Axm :
public Def,
public Setters<Axm> {
46 static std::tuple<const Axm*, u8, u8>
get(
const Def* def);
67 template<
class Id,
class D>
class IsA {
68 static_assert(
Annex::Num<Id> != size_t(-1),
"invalid number of sub tags");
79 const Axm*
axm()
const {
return axm_; }
81 operator const D*()
const {
return def_; }
82 explicit operator bool() {
return axm_ !=
nullptr; }
96 const Axm* axm_ =
nullptr;
97 const D* def_ =
nullptr;
104 template<
class Id,
bool DynCast = true>
static auto isa(
const Def* def) {
110 assert(cond &&
"assumed to be correct axm");
114 template<
class Id,
bool DynCast = true>
static auto isa(Id
id,
const Def* def) {
117 bool cond = axm &&
curry == 0 && axm->flags() == (
flags_t)
id;
120 assert(cond &&
"assumed to be correct axm");
126 template<
class Id>
static auto as(Id
id,
const Def* def) {
return isa<Id, false>(
id, def); }
auto id() const
Axm::flags cast to Id.
const D * operator->() const
IsA(const Axm *axm, const D *def)
static auto as(Id id, const Def *def)
NormalizeFn normalizer() const
static auto isa(const Def *def)
static std::pair< u8, u8 > infer_curry_and_trip(const Def *type)
static auto isa(Id id, const Def *def)
static constexpr u8 Trip_End
static constexpr auto Node
static auto as(const Def *def)
static std::tuple< const Axm *, u8, u8 > get(const Def *def)
Yields currying counter of def.
const Def * rebuild_(World &, const Def *, Defs) const override
Def * set(size_t i, const Def *)
Successively set from left to right.
constexpr flags_t flags() const noexcept
const Def * type() const noexcept
Yields the "raw" type of this Def (maybe nullptr).
CRTP-based Mixin to declare setters for Def::loc & Def::name using a covariant return type.
constexpr bool is_commutative(Id)
const Def *(*)(const Def *, const Def *, const Def *) NormalizeFn
constexpr bool is_associative(Id id)
static sub_t flags2sub(flags_t f)
Yields the sub part of the name as integer.
static plugin_t flags2plugin(flags_t f)
static flags_t flags2base(flags_t f)
Includes Axm::plugin() and Axm::tag() but not Axm::sub.
static constexpr size_t Num
static constexpr flags_t Base
static tag_t flags2tag(flags_t f)
Yields the tag part of the name as integer.