About 28,200,000 results
Open links in new tab
  1. How is vector implemented in C++ - Stack Overflow

    Jan 7, 2020 · Since vector is a template, you actually should have its source to look at if you want a reference – if you can get past the preponderance of underscores, it shouldn't be too hard to …

  2. Relative performance of std::vector vs. std::list vs. std::slist?

    Oct 26, 2008 · A vector has an array of elements addressed by index. From this you can see that both can do efficient forwards and backwards traversal, while only a vector can provide …

  3. What are vectors and how are they used in programming?

    This pair (3, 4) is also a mathematical vector. In programming, this name "vector" was originally used to describe any fixed-length sequence of scalar numbers. A vector of length 2 represents …

  4. std::vector versus std::array in C++ - Stack Overflow

    Dec 12, 2010 · std::vector is a template class that encapsulate a dynamic array 1, stored in the heap, that grows and shrinks automatically if elements are added or removed. It provides all …

  5. Is std::vector so much slower than plain arrays? - Stack Overflow

    Sep 8, 2010 · So array is twice as quick as vector. But after looking at the code in more detail this is expected; as you run across the vector twice and the array only once. Note: when you …

  6. c++ - Vector of Vectors to create matrix - Stack Overflow

    I am trying to take in an input for the dimensions of a 2D matrix. And then use user input to fill in this matrix. The way I tried doing this is via vectors (vectors of vectors). But I have encount...

  7. c++ - What's faster, iterating an STL vector with vector::iterator or ...

    I have been doing benchmarks myself, and vector.at is much slower than using an iterator, however using vector [i] is much faster than using an iterator. However, you can make the loop …

  8. C++ std::vector vs array in the real world - Stack Overflow

    I work for HP on a 2.5 million line code base. We strive to use vectors any time we need a resizeable array. I've never seen the STL used in Academia, and I'm not sure why, but trust …

  9. Initializing a two-dimensional std::vector - Stack Overflow

    Here, the vector 'v' can be visualised as a two dimensional array, with 'A_NUMBER' of rows, with 'OTHER_NUMBER' of columns with their initial value set to 'DEFAULT_VALUE'.

  10. Arrays vs Vectors: Introductory Similarities and Differences

    Feb 26, 2013 · A vector is a dynamically-sized sequence of objects that provides array-style operator[] random access. The member function push_back copies its arguments via copy …