   2D arrays using STL vector template
  i am experimenting with STL and thinking about implementing a 2D array class with the vector template.first of all.. tell me if its a good idea to implement the 2D array as a typedef vector< vector<double> >  TMatrix and if i implement the array in this fashion, how can i use the iterators for each row (since each row is now a vector)?let me know as soon as possible :)thankxsiddord   
  If you want a real matrix (with multiplication, GaussianElimination...etc), and not just a vector of vector of values,then you're better off writing a new class or using an existinglibrary.   ;  Well, first, obtain an iterator to the outer vector, which allows you to iterate from row to row.  Then simple obtain in iterator from each row.  if anything eneds explaining, just say.   ;  Use boost::multi_array  :)   ;  thankx... i am working on tht right now :)well i want to implement a matrix class which supports all the mathematical operations + a resize capability. Since Vector provides a very robust way to resize the matrix, I was interested in exploiting it.   ;  Note that a vector of vectors will give you terrible locality of reference something that will in the matrix case cost you quite much in terms of performance. I would say either look into the boost option or create your own wrapper better suited for your scenario. A vector of vectors very usable if you do need jagged arrays though.   ;  Or you could start working with std::numarray.   ;Quote:Original post by FrunyOr you could start working with std::numarray.Don't you mean std::valarray? I haven't heard of a std::numarray (at least not in TC++PL by Stroustrup)   ;  I think the wires in his brain got crossed with Numerical Python. :)   