C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Specify the mangled name

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Mon, 3 Feb 2025 20:10:33 +0300
On 2/3/25 18:52, Thiago Macieira via Std-Proposals wrote:
> On Monday 3 February 2025 03:13:58 Pacific Standard Time Andrey Semashev via
> Std-Proposals wrote:
>>> When compiling the above source file, the compiler emits a mangled
>>> name for the function "NormaliseIndexSet". But in order to be able to
>>> do this, the full definition of the template class "std::set" is
>>> required inside the translation unit.
>>
>> It is not. A forward declaration would suffice.
>
> It would, except you can't get one because it's a Standard Library type. Only
> the Standard Library can provide those and it doesn't.

Does adding a forward declaration for a standard library component count
as "adding something to namespace std", which is forbidden by the standard?

With some effort, it is possible to add forward declarations for
standard library components for specific standard library
implementations, and it works quite well in practice. For other unknown
implementations you would just include the proper standard library header.

> A <containerfwd> header would be very helpful.

True, though I would prefer distinct headers like <set_fwd>,
<vector_fwd>, etc.

Received on 2025-02-03 17:10:35