C++ Logo

std-discussion

Advanced search

Re: How do I know whether a call to a constexpr standard library function is actually a constant expression?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 15 Nov 2019 13:53:23 -0800
On sexta-feira, 15 de novembro de 2019 13:00:44 PST Brian Bi wrote:
> > What do you mean by "constexpr context"?

constexpr or constinit variable initialisation, template parameters, size of
arrays (aside from Variable Length Arrays), etc.

> > Why does it matter?
>
> It matters because it determines whether:
>
> constexpr auto x = some_constexpr_library_function(some_args)
>
> actually compiles.

If the standard says the function is constexpr, some_args are constant
expression too, then it compiles.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

Received on 2019-11-15 15:55:44