Share this post

Link to post

Share on other sites

If you're talking about std::vector, then the equivalent is asking what is the use for a closet. You can store lots of things in a closet. Be it clothes, shoes, money, documents. If documents, they can be in alphabetical order, in chronological order, in random order. There's almost no limit.

Vector is the most generic container.

It's the equivalent of a pointer array in C, except you get a few bonuses (don't have to worry about deallocation most of the time, the array can be resized automatically)

Share this post

Link to post

Share on other sites

Dozens?? Try hundreds if not thousands. Nearly everything in our codebase is driven by vectors. If I have one of something, it lives in a variable/object. If I have two or more of something, it goes into a vector. We literally never use operator new[] or delete[].

Share this post

Link to post

Share on other sites

i had a rigorous background in simpler programming venues that gravitated me towards retaining simple methods.

the reason to use vectors is because they are simpler, eg. if you have two 3d points stored as vectors, you can add them by writing a + b instead of separately adding each dimension. makes code easier to read and write :)

0

Share this post

Link to post

Share on other sites

i had a rigorous background in simpler programming venues that gravitated me towards retaining simple methods.

the reason to use vectors is because they are simpler, eg. if you have two 3d points stored as vectors, you can add them by writing a + b instead of separately adding each dimension. makes code easier to read and write

That's a different kind of vector.

LAURENT* could be talking about that kind of vector (math related), or he could be talking about the container type std::vector.