C++ template name mangling

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 16 11:27:28 PDT 2014


On Saturday, 16 August 2014 at 01:55:44 UTC, Andrei Alexandrescu 
wrote:
> template <
>   class charT,
>   class traits = char_traits<charT>,
>   class Alloc = allocator<charT>
> >
> class basic_string {
>   bool empty() const { ... }
>   ...
> private:
>   ... state ...
> };
>
> That could be replicated in D as follows:
>
> extern(C++)
> struct basic_string(charT,
>   traits = char_traits!charT,
>   Alloc = allocator!charT)
> {
>     bool empty() const; // no definition!
>           // generate mangled call to C++ function

Doesn't function defined in header behave like `static inline`, 
or hidden. There could be nothing to link with.


More information about the Digitalmars-d mailing list