[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: c++: 2D array



#
#template <class T>
#class Matrix{
#public:
#	T * matrix ;
#	
#	
#private:
#	int rows;
#	int cols;
#	int size;
#
#public :
#	Matrix (int r, int c) {
#		rows = r;
#		cols =c;
#		size=rows*cols;
	
	More effiecient code :
	Matrix (const int r, const int c ) : rows(r),cols(c), size(r*c) {...

	And for God's sake don't run these functions as inline. Define
functions outside class definitions.
	


#	T* operator[](int x) {
#		/* I am adding bounds checking logic due to two 
#reasons :

	You mean " I am NOT adding " , i guess. Typo , it seems :)



Shourya 'turncoat' Sarcar