www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - how to shorten templates structs name?

reply drug <drug2004 bk.ru> writes:
using classes I can make an inherited class of templated class and avoid 
too long mangled name:
```
class TemplatedClass(A, Very, Much, Args, Here) { ... }

class ShortenClass : TemplatedClass!(A,Very, Much, Args, Here) { ... };
```
Now ShortenClass has a nice mangling.

What can be done in case of struct?
Oct 10 2017
next sibling parent Daniel Kozak <kozzi11 gmail.com> writes:
Use alias this

Dne 10. 10. 2017 1:30 odpoledne napsal u=C5=BEivatel "drug via
Digitalmars-d-learn" <digitalmars-d-learn puremagic.com>:

 using classes I can make an inherited class of templated class and avoid
 too long mangled name:
 ```
 class TemplatedClass(A, Very, Much, Args, Here) { ... }

 class ShortenClass : TemplatedClass!(A,Very, Much, Args, Here) { ... };
 ```
 Now ShortenClass has a nice mangling.

 What can be done in case of struct?
Oct 10 2017
prev sibling parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 10/10/2017 04:30 AM, drug wrote:
 using classes I can make an inherited class of templated class and avoid
 too long mangled name:
 ```
 class TemplatedClass(A, Very, Much, Args, Here) { ... }

 class ShortenClass : TemplatedClass!(A,Very, Much, Args, Here) { ... };
 ```
 Now ShortenClass has a nice mangling.

 What can be done in case of struct?
I think an alias is more suitable here for both classes and structs: alias ShortenClass = TemplatedClass!(int,bool, float, ubyte, string); Ali
Oct 10 2017