At 4:52 PM +0200 on 7/20/99, M. Uli Kusterer wrote:
>Hi,
>
> just asking: has anyone yet written some cross-platform array class in
>which I can store lists of pointers? Or what ANSI C++ class would I have to
>use (vector?) and how?

Yes, vector.

Try this to use a vector:

        #include <vector>               // note: No .h
        using namespace std;

        int main() {
                vector<int *> myPtrs;
                while (add_more_ints())
                        myPtrs.push_back(new int(0));

                ...

                for (int x = 0; x < myPtrs.size(); ++x)
                        delete myPtrs[x];
                return 0;
        }


There's a bunch of those things. I like maps a lot, too.

Reply via email to