import io; typedef NoTraits {}; typedef Trait1 (FirstTrait) {}; typedef Trait2 (SecondTrait) {}; typedef TwoTrait (FirstTrait, SecondTrait) {}; typedef AlreadySpecilized (FirstTrait, SecondTrait) {}; template void OneTwoFunc(T obj) { println("No Traits"); } template void OneTwoFunc(T obj) { println("First Trait"); } template void OneTwoFunc(T obj) { println("Second Trait"); } template void OneTwoFunc(T obj) { println("Both Traits"); } /* template void OneTwoFunc(AlreadySpecilized obj) { println("Already Specilized"); } */ //This should work for objects too! //To test, we cycle the mapping of traits /* *typedef template OneTwoObj (FirstTrait) {}; *typedef template OneTwoObj (SecondTrait) {}; *typedef template OneTwoObj (FirstTrait, SecondTrait) {}; *typedef template OneTwoObj {}; *typedef template OneTwoObj { * void proveSpecilized() { * println("I'm specilized!"); * } *}; */ int main() { NoTraits a; Trait1 b; Trait2 c; TwoTrait d; AlreadySpecilized e; OneTwoFunc(a); OneTwoFunc(b); OneTwoFunc(c); OneTwoFunc(d); // OneTwoFunc(e); println(); /* * OneTwoObj alpha; * OneTwoObj beta; * OneTwoObj gamma; * OneTwoObj delta; * OneTwoObj epsilon; * * OneTwoFunc>(alpha); * OneTwoFunc>(b); * OneTwoFunc>(c); * OneTwoFunc>(d); * * //We can't pass along our inner part, so let's just make sure that it is the right object. * //epsilon.proveSpecilized(); */ return 0; }