// // Template class for square NxN matrices with elements of type T. // This is just for demonstration purposes. // template class GenericMatrix { private: T data[N][N]; public: T& operator()( int i, int j ) {return data[i][j];} const T& operator()( int i, int j ) const {return data[i][j];} // GenericMatrix addition - except for very small N, the execution time // will dominate the overhead for calling it and thus declaring // it inline is probably counterproductive. friend GenericMatrix operator+( const GenericMatrix& A, const GenericMatrix& B ) { GenericMatrix result; for( int i=0; i Matrix; Matrix Calculation( const Matrix& a, const Matrix& b, const Matrix& c, const Matrix& d, const Matrix& e ) { // At optimization level +K1 and higher, without // --inline_keyword_space_time=8, KCC will relentlessly // inline all the calls to operator* and operator+ below. return a*b + c*d + e; } main() { // Dummy main provided so that example compiles. }