Date: Sat, 23 Oct 2021 08:20:52 -0700
On Saturday, 23 October 2021 00:27:30 PDT Michael Scire via Std-Proposals
wrote:
> In particular, a common use case might be like:
>
> ```
> if constexpr (std::is_constexpr_constructible<T>::value) {
> constexpr T t{/* potentially arguments here */};
> // Use t as a non-type-template parameter, or use it in other
> compile-time only ways like for static asserts.
> } else {
> T t{/* potentially arguments here */};
> // Use t as a runtime value.
> }
> ```
Can you give more details and an actual, small example of what the comments
would actually be? I'm having trouble visualising what code would exist that
depends on an unknown type's ability to be constructed constexprly.
In other words, can you give more details on what this functionality would
enable?
wrote:
> In particular, a common use case might be like:
>
> ```
> if constexpr (std::is_constexpr_constructible<T>::value) {
> constexpr T t{/* potentially arguments here */};
> // Use t as a non-type-template parameter, or use it in other
> compile-time only ways like for static asserts.
> } else {
> T t{/* potentially arguments here */};
> // Use t as a runtime value.
> }
> ```
Can you give more details and an actual, small example of what the comments
would actually be? I'm having trouble visualising what code would exist that
depends on an unknown type's ability to be constructed constexprly.
In other words, can you give more details on what this functionality would
enable?
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DPG Cloud Engineering
Received on 2021-10-23 10:21:01