Created
October 26, 2018 20:31
-
-
Save gwy15/5a664ccf8b687ccc89c04e924fc98aef to your computer and use it in GitHub Desktop.
template compile OTM
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
#include <iostream> | |
#include <tuple> | |
template <int n> auto foo(int a) { | |
return std::make_tuple(foo<n - 1>(a), foo<n - 1>(a)); | |
} | |
template <> auto foo<0>(int a) { return std::make_tuple(a, a); } | |
int main() { | |
auto i = foo<100>(2); | |
std::cout << &i << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment