Created
December 18, 2014 19:18
-
-
Save neoneye/af985fac27bc7cdc7836 to your computer and use it in GitHub Desktop.
Curiously recurring template pattern in swift is not working
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
// https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern | |
class Foo <T: Any> : T { | |
func hello() { println("hello") } | |
} | |
class Bar { | |
func world() { println("world") } | |
} | |
let foobar = Foo<Bar>() | |
foobar.hello() | |
foobar.world() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I only know the basics of C++ but even I can see that this is not CRTP here.
If you're interested (after the bug I mention in my blog post is fixed) the following code should work: