public alias to private template implementation

monarch_dodra monarchdodra at gmail.com
Mon Sep 16 23:29:35 PDT 2013


On Monday, 16 September 2013 at 23:53:14 UTC, Meta wrote:
> So you're really directly accessing a private symbol. Perhaps a 
> workaround could be something like this:
>
> //----
> module Test;
> static const fun = &Impl!int;
> private template Impl(T)
> {
>     void Impl(){}
> }
>
> //----
> module main;
> import Test;
> void main()
> {
>     fun();
> }
>
> I had to do fun = &Impl!int because the compiler complained 
> about fun = Impl!int.

This seems to be not working, because Impl actually holds an 
overload. It's actually something like:

private template Impl(T)
{
     void Impl(){}
     void Impl(int){}
}

Grown.


More information about the Digitalmars-d-learn mailing list