Date: Mon, 3 Feb 2025 14:13:58 +0300
On 2/3/25 13:59, Frederick Virchanza Gotham via Std-Proposals wrote:
>
> Here's an alternative:
>
> #include <set>
>
> typedef std::set<unsigned> IndexSet;
>
> extern void RemoveDuplicates(IndexSet&);
> extern void SmoothenValues(IndexSet&);
>
> void NormaliseIndexSet( IndexSet &arg )
> {
> RemoveDuplicates(arg);
> SmoothenValues(arg);
> }
>
> 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.
>
> Here's an alternative:
>
> #include <set>
>
> typedef std::set<unsigned> IndexSet;
>
> extern void RemoveDuplicates(IndexSet&);
> extern void SmoothenValues(IndexSet&);
>
> void NormaliseIndexSet( IndexSet &arg )
> {
> RemoveDuplicates(arg);
> SmoothenValues(arg);
> }
>
> 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.
Received on 2025-02-03 11:14:01