Workaround for DIP 1005

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 7 17:01:41 PST 2017


On 2/7/2017 7:00 AM, Andrea Fontana wrote:
> I don't understand why we can't use a template like:
>
> auto fun_time(SysTime)(SysTime tm)
> {
>     import std.datetime;
>     static assert (is(SysTime == std.datetime.SysTime));
>     return tm;
> }
>
> void main()
> {
>   import std.stdio;
>   import std.datetime;
>
>   fun_time(Clock.currTime()).writeln;
> }

It's an interesting idea, but it will have problems with overloading, as the 
template selection will match on everything.



More information about the Digitalmars-d mailing list