Created
January 21, 2022 15:19
-
-
Save hjroh0315/05d37bbfa4bf50eb00e25a93576ae5d7 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
#include<iostream> | |
template <int ... Ns> struct sequence {}; | |
template <int ... Ns> struct seq_gen; | |
template <int I,int J, int ... Ns> | |
struct seq_gen<I,J, Ns...> | |
{ | |
using type = typename seq_gen< | |
J-I,I,J, Ns...>::type; | |
}; | |
template <int ... Ns> | |
struct seq_gen<1,1, Ns...> | |
{ | |
using type = sequence<1,1,Ns...>; | |
}; | |
template<int ... Ns> | |
void print(sequence<Ns...> seq) | |
{ | |
(std::cout << Ns << " ",...); | |
std::cout<<std::endl; | |
} | |
template <int N,int O> | |
using sequence_t = typename seq_gen<N,O>::type; | |
using namespace std; | |
int main() | |
{ | |
sequence_t<196418, 317811> seq; | |
print(seq); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment