C++ Logo

sg7

Advanced search

Re: [SG7] From TMP to value-based reflection

From: Matus Chochlik <chochlik_at_[hidden]>
Date: Wed, 8 Dec 2021 19:45:13 +0100
> consteval auto unreflect_type(meta::info mo) {

> > return std::type_identity<typename [: mo :]>{};
> > }
>
> I'm going by memory so I may get something wrong,
> but when I played with this, even something like
>
> consteval bool is_const( meta::info info )
> {
> return std::is_const_v<[: info :]>;
> }
>
> didn't work. Note that this doesn't vary the return
> type.
>
> This means that all the consteval primitives like
> is_const have to be supplied by std, users can't write
> their own.
>
> I don't however remember whether this was a
> limitation of the reference implementation, or of
> the underlying model.
>

Clang's AST transforms and the integral expression evaluators are still
mostly like wonderland to me ;) but I think that this is a fundamental
problem of template arguments not being able to depend on the values of
consteval parameters.

Received on 2021-12-08 12:45:27