Dynamics...

This is a discussion on Dynamics... within the C++ Programming forums, part of the General Programming Boards category; I have a variable **foo which I let user to initialize to foo[x][y]. Now, the problem is that how to ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    129

    Dynamics...

    I have a variable **foo which I let user to initialize to foo[x][y]. Now, the problem is that how to change that size in the fly so, in example, when I first have foo[10][10] I would later have foo[100][100]. I could of course use another variable for swapping but I'm thinking of sizes like foo[10000][10000] so that would be a real memory eater (though, even without the temporary variable).

    I've been thinking of linked lists, but that would be slow and still eats lots of memory. Any ideas?
    kooma - t.h@iki.fi

  2. #2
    duck-billed-platypus
    Guest
    How about using a vector container class that allows resizing and create another class that is a vector of a vector.

    template <class T>
    class CMatrix
    {
    .
    .
    .
    private:
    vector<vector<T> > myVector;
    };

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. operator dynamics
    By ygfperson in forum C++ Programming
    Replies: 4
    Last Post: 05-03-2003, 04:24 PM
  2. Pointer Dynamics
    By vasanth in forum C++ Programming
    Replies: 3
    Last Post: 10-08-2002, 10:15 AM
  3. Why would I need pointers.
    By dasher in forum C++ Programming
    Replies: 7
    Last Post: 12-09-2001, 10:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21