29.07.2010, 12:17
(
Последний раз редактировалось Remis; 29.07.2010 в 12:27.
)
You mean C, not C++. If you want to program in C++, put the arrays you know from C aside and begin programming in C++ - using vectors and other containers. (like Balon said).
http://www.parashift.com/c++-faq-lite/containers.html
It returns the error, because you are saving the objects on the stack, which has a limited size.
Begin storing them in the free store, which is only limited by the size of the RAM.
(The vector is saving his objects on the free store. You can also use new and delete - dynamic memory. The containers are using them.)
It is even more simpler if you would take use of the boost library. They have also solutions.
Edit: Examples
Vectors:
http://cplusplus.com/reference/stl/vector/
You add elements with push_back
http://cplusplus.com/reference/stl/vector/push_back/
There are examples
Dynamic Memory:
http://cplusplus.com/doc/tutorial/dynamic/
Boost library containers:
http://www.boost.org/doc/libs/1_43_0...htm#Containers
http://www.parashift.com/c++-faq-lite/containers.html
It returns the error, because you are saving the objects on the stack, which has a limited size.
Begin storing them in the free store, which is only limited by the size of the RAM.
(The vector is saving his objects on the free store. You can also use new and delete - dynamic memory. The containers are using them.)
It is even more simpler if you would take use of the boost library. They have also solutions.
Edit: Examples
Vectors:
http://cplusplus.com/reference/stl/vector/
You add elements with push_back
http://cplusplus.com/reference/stl/vector/push_back/
There are examples
Dynamic Memory:
http://cplusplus.com/doc/tutorial/dynamic/
Boost library containers:
http://www.boost.org/doc/libs/1_43_0...htm#Containers