Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- template <typename T, int lhs_size, int rhs_size>
- array<T, lhs_size + rhs_size> concat(const array<T, lhs_size>& lhs, const array<T, rhs_size>& rhs){
- array<T, lhs_size + rhs_size> result;
- // copy values from lhs and rhs to result
- return result;
- }
- template< int n >
- struct factorial { enum { ret = factorial< n - 1 >::ret * n }; };
- template<>
- struct factorial< 0 > { enum { ret = 1 }; };
- int main() {
- cout << "7! = " << factorial< 7 >::ret << endl; // 5040
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement