Created
July 26, 2018 08:30
-
-
Save Rydgel/9ed8c54699096948779d7d9e0e5f5bee 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
struct A { char* name = "A"; }; | |
struct B { char* name = "B"; }; | |
auto dispatch = [](int n, auto continuation) { | |
switch (n) { | |
case 0: return continuation(A{}); | |
case 1: return continuation(B{}); | |
} | |
// throw or something here | |
}; | |
auto f() { | |
return dispatch(1, [](auto t) { return t.name; }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment