template<class Self>
class fe::VLA< Self >
CRTP base that gives Self one VLA per element type in Self::VLA_Types directly behind it in memory - the C flexible array member, generalized to several arrays of different type.
Self must be created through Arena::mk or Arena::ref, which allocate the arrays along with Self and fill them from the last Self::VLA_Types arguments, in that order. This base is empty - the element counts live at the front of the VLA block - so that Self::VLA_Types may name types only declared inside Self.
class Interval :
public Node,
public fe::VLA<Interval> {
public:
using VLA_Types = std::tuple<const Expr*, const Expr*>;
Interval(
Loc loc, Tag from, Tag to);
auto from_args()
const {
return vla<0>(); }
auto to_args()
const {
return vla<1>(); }
};
arena.ref<Interval>(loc, from, to, from_args, to_args);
CRTP base that gives Self one VLA per element type in Self::VLA_Types directly behind it in memory - ...
auto vla() const noexcept
The I th VLA as a View<VLA_Type<I>>.
Location within a Src: the half-open byte range [Loc::begin, Loc::end).
- Warning
- Only the most derived class may carry them. A class deriving from
Self would inherit this base and place its arrays at Self's offset - on top of its own members - so Arena::mk and Arena::ref reject it.
Definition at line 38 of file vla.h.