fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. constexpr int constmax(int a, int b) {
  5. return a>b?a:b;
  6. }
  7.  
  8. template<int size,typename basic_type=unsigned int,typename long_type=unsigned long long,long_type base=256>
  9. class NSize
  10. {
  11. template <int lengthA, int lengthB>
  12. friend NSize<constmax(lengthA,lengthB)> operator * (const NSize<lengthA> &a, const NSize<lengthB> &b);
  13.  
  14. public:
  15. NSize(basic_type){}
  16. };
  17.  
  18. template <int lengthA, int lengthB>
  19. NSize<constmax(lengthA,lengthB)> operator * (const NSize<lengthA> &a, const NSize<lengthB> &b)
  20. {
  21. return NSize<constmax(lengthA,lengthB)>(0);
  22. }
  23.  
  24.  
  25.  
  26. int main() {
  27. NSize<30> a(101);
  28. NSize<25> b(120);
  29. NSize<30> c(115);
  30. NSize<30> res = (a*b)*(a*c)*(c*b)*(b*a)*(a*c);
  31. }
  32.  
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty