fork download
  1. #include <iostream>
  2.  
  3.  
  4. namespace MATH {
  5.  
  6.  
  7. template <std::size_t M, std::size_t N, class T>
  8. class Matrix
  9. {
  10.  
  11. };
  12.  
  13. void invert(Matrix<2, 2, double>& m)
  14. {
  15. std::cout << "DIM 2 : MATH version (use of the determinant)" << std::endl;
  16. }
  17.  
  18. void invert(Matrix<3, 3, double>& m)
  19. {
  20. std::cout << "DIM 3 : MATH version (use of the determinant)" << std::endl;
  21. }
  22.  
  23.  
  24. }
  25.  
  26.  
  27. namespace GEOM {
  28.  
  29.  
  30. //template <std::size_t N>
  31. //using Matrix = MATH::Matrix<N, N, double>;// orthonormal set of vectors
  32. template <std::size_t N>
  33. class Matrix : public MATH::Matrix<N, N, double> {};// orthonormal set of vectors
  34.  
  35.  
  36. template <std::size_t N>
  37. void invert(Matrix<N>& m)
  38. {
  39. std::cout << "DIM " << N << " : GEOM version (use of the transpose)" << std::endl;
  40. }
  41.  
  42. void geom_foo_purpose(Matrix<3>& m)
  43. {
  44. invert(m);
  45. }
  46.  
  47.  
  48. }
  49.  
  50.  
  51. int main(int argc, char **argv)
  52. {
  53. GEOM::Matrix<3> m;
  54. GEOM::geom_foo_purpose(m);
  55. MATH::invert(m);
  56.  
  57. return 0;
  58. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
DIM 3 : GEOM version (use of the transpose)
DIM 3 : MATH version (use of the determinant)