Purpose of template DECLARE_HANDLE in druntime

Andre Pany andre at s-e-a-p.de
Thu Jan 31 20:51:37 UTC 2019


Hi,

I noticed in druntime this template is used often:

package template DECLARE_HANDLE(string name, base = HANDLE) {
     mixin ("alias " ~ base.stringof ~ " " ~ name ~ ";");

The disadvantage is, IDEs like IntelliJ are not able to find the 
symbols using this template e.g.
mixin DECLARE_HANDLE!("SC_HANDLE");

What is the benefit of this template?
Why can't we just use
alias HANDLE SC_HANDLE;

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list