Created
February 18, 2017 14:03
-
-
Save jkotas/07f1f77505611168c295993073633d71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
struct MyG<T,U> : IEquatable<MyG<T,U>> | |
{ | |
static bool visited; | |
public static void foo(int depth) | |
{ | |
if (visited) return; | |
visited = true; | |
EqualityComparer<MyG<T,U>>.Default.Equals(default(MyG<T,U>), default(MyG<T,U>)); | |
if (depth-- == 0) return; | |
MyG<U,T>.foo(depth); | |
MyG<MyG<T,U>,T>.foo(depth); | |
MyG<MyG<T,U>,U>.foo(depth); | |
MyG<T,MyG<T,U>>.foo(depth); | |
MyG<U,MyG<T,U>>.foo(depth); | |
} | |
public bool Equals(MyG<T,U> other) | |
{ | |
return true; | |
} | |
} | |
class My | |
{ | |
static void Main() | |
{ | |
int start = Environment.TickCount; | |
MyG<string,int>.foo(6); | |
int end = Environment.TickCount; | |
Console.WriteLine((end-start).ToString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment