Mail Archives: djgpp/1999/10/07/23:26:28
In article "Bradley A. Town" <btown AT nospam DOT com>
wrote:
> Nick,
> Check out section 16.3.3 in
Stroustrup. "...operator[]() provides
> unchecked access, whereas at() does a range
check and throw out_of_range if
> an index is out of range."
Yes, but not quite the problem I'm trying to
solve. I understand about checked or unchecked
indexing, but how do I pre-allocate for a
particular size of matrix?
vector<int> a(10); allocates a one-d vector of
ten elements. I want to do something like
vector< vector<int>(10) > a(10); to allocate a
matrix with ten rows and ten columns, instead of
doing
int a[10][10];
I'm not sure this is possible with the STL.
Perhaps I need to write a two-d matrix class?
Nick.
>
> ---
> Bradley A. Town
> Lead Software Engineer
> Test Products, Inc.
> E-mail: btown at testprod.com
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
- Raw text -