pochti_da

Untitled

May 17th, 2021
611
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstddef>
  2.  
  3. namespace Sample {
  4.  
  5. template <typename T, const size_t N, const size_t M>
  6. class Matrix {
  7. private:
  8.     class Row {
  9.     private:
  10.         T row[M];
  11.  
  12.     public:
  13.         const T & operator[] (size_t i) const {
  14.             return row[i];
  15.         }
  16.  
  17.         T & operator[] (size_t i) {
  18.             return row[i];
  19.         }
  20.     };
  21.  
  22.     Row data[N];
  23.  
  24. public:
  25.     const Row & operator[] (size_t i) const {
  26.         return data[i];
  27.     }
  28.  
  29.     Row & operator[] (size_t i) {
  30.         return data[i];
  31.     }
  32.  
  33. };
  34.  
  35. }
RAW Paste Data