Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest May 25th, 2012 141 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename T, int lhs_size, int rhs_size>
  5. array<T, lhs_size + rhs_size> concat(const array<T, lhs_size>& lhs, const array<T, rhs_size>& rhs){
  6.  
  7.   array<T, lhs_size + rhs_size> result;
  8.   // copy values from lhs and rhs to result
  9.   return result;
  10.  
  11. }
  12.  
  13. template< int n >
  14. struct factorial { enum { ret = factorial< n - 1 >::ret * n }; };
  15.  
  16. template<>
  17. struct factorial< 0 > { enum { ret = 1 }; };
  18.  
  19. int main() {
  20.     cout << "7! = " << factorial< 7 >::ret << endl; // 5040
  21.     return 0;
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top