C++ Logo

sg7

Advanced search

Re: [SG7] type_traits vs value-based reflection world

From: Andrew Sutton <asutton.list_at_[hidden]>
Date: Mon, 2 Nov 2020 11:11:46 -0500
>
> > A constexpr-based model for type traits should reduce the number of
> class
> > template instantiations needed during compilation. Instantiating classes
> > can be costly (in terms of analyses performed and memory required for
> > specializations). Calling a non-template constexpr function is
> relatively
> > cheap by comparison.
>
> Isn't there a more immediate reason for this? As far as I can see, it's
> not
> currently possible to splice in consteval functions that take meta::info,
> because the argument is not a constant expression. One can however call
> meta::is_arithmetic on it.
>
> E.g. https://cppx.godbolt.org/z/EG71jY
>

Good point. I'm putting the cart before the horse here (I blame lack of
coffee). "Usable in more contexts" is better motivation than compiler
performance.

Andrew

Received on 2020-11-02 10:12:00