C++ Logo

std-proposals

Advanced search

Re: Remove non-type template limitations for consteval functions

From: Robert J. Simpson <robert.simpson.lists_at_[hidden]>
Date: Wed, 24 Feb 2021 12:57:26 +0000
One of the requirements is that types must be comparable and in the case
of non-type templates that means comparing values. E.g. jf you have a
'const char*' value then what does it mean for two of these values to be
equal?

Rob.

On 24/02/2021 12:01, Bastien penavayre via Std-Proposals wrote:
> Hi,
> Currently, non-type templates still have several limitations:
> - must be structural (no private members)
> - no allocations even if the type has a constexpr destructor
> - can't contain floating point (double or float)
> - can't hold strings of the "const char *" form
> and so on...
>
> These limitations have a good reason behind them for templated class
> and function as they produce symbols in assembly and need to be resolved.
>
> But as consteval functions never produce assembly/symbols and will
> never be resolved by another translation unit than their own these
> restrictions should be lifted.
>
> What are your thoughts on this?
> Am I missing something?
>
> Thanks in advance,
> Bastien Penavayre
>

Received on 2021-02-24 06:57:30