C++ Logo


Advanced search

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

From: Peter Dimov <pdimov_at_[hidden]>
Date: Mon, 2 Nov 2020 17:58:35 +0200
Andrew Sutton wrote:
> > Why is needed is_arithmetic in the "reflection world" ?
> >
> > Does std::is_arithmetic< typename(reflexpr(int)) >::value is the same as
> > reflexpr(int)::is_arithmetic() ?
> 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

Received on 2020-11-02 09:58:47