[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: kdebase/libkonq doesn't build
From:       Guillaume Laurent <glaurent () telegraph-road ! org>
Date:       2000-06-15 12:44:07
[Download RAW message or body]

David Faure <david@mandrakesoft.com> writes:

> What's the proper C++ way to do this (allocate a dynamic 2-dimension
> array) ?

Something like this :

    typedef vector< vector<int> > twodimarray;
    
    unsigned int dimx = 5, dimy = 10;
    
    twodimarray v(dimx);

    for(twodimarray::iterator i = v.begin(); i != v.end(); ++i)
	i->reserve(dimy);


Although most of the time you're probably better of with just

    typedef vector< vector<int> > twodimarray;
    twodimarray v(dimx);

and then store values in it with

    v[i].push_back(intValue);

-- 
						Guillaume
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic