C++ Logo

std-proposals

Advanced search

Re: is_complete type trait?

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Fri, 12 Nov 2021 13:07:15 +0000
On Fri, 12 Nov 2021 00:50:21 +0100
Bjorn Reese via Std-Proposals <std-proposals_at_[hidden]> wrote:

> Has there been any proposals to add a type trait to check if a type
> is complete?

Hi,

I mainly agree with others that this is a footgun and it simply can't
be standardized at least in the same form as the other traits.

Having said that it is not completely useless, I found it useful for
creating a trait equivalent to `is_convertible_v<T*, U*>`, except it
being ill-formed instead of undefined behavior when it's
undecidable if it's true or false when completing T or U.

I have a macro implementation that works with C++11:

https://godbolt.org/z/q4e8xWv17

It's still a huge footgun, having any named entities depend on it can
quickly result in ODR-violation and it should be handled with great
care.

Cheers,
Lénárd

Received on 2021-11-12 07:07:29