C++ Logo


Advanced search

Subject: Re: type_traits vs value-based reflection world
From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-11-02 09:58:35

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

SG7 list run by sg7-owner@lists.isocpp.org

Older Archives on Google Groups