About 189,000 results
Open links in new tab
  1. How does c++ std::vector work? - Stack Overflow

    Jul 2, 2010 · The basics of std::vector physical representation is of a set of pointers using memory allocated from the heap. These pointers allow for the actual operations for accessing the …

  2. Iterate through a C++ Vector using a 'for' loop - Stack Overflow

    Oct 3, 2012 · I am new to the C++ language. I have been starting to use vectors, and have noticed that in all of the code I see to iterate though a vector via indices, the first parameter of …

  3. Delete all items from a c++ std::vector - Stack Overflow

    I'm trying to delete everything from a std::vector by using the following code

  4. How to assign a std::vector using a C-style array?

    What is the cheapest way to initialize a std::vector from a C-style array? Example: In the following class, I have a vector, but due to outside restrictions, the data will be passed in as C-style ...

  5. How do I find an element position in std::vector? - Stack Overflow

    I need to find an element position in an std::vector to use it for referencing an element in another vector: int find( const vector<type>& where, int searchParameter ) { for( int i =...

  6. check if a std::vector contains a certain object? [duplicate]

    Aug 10, 2010 · See question: How to find an item in a std::vector? You'll also need to ensure you've implemented a suitable operator==() for your object, if the default one isn't sufficient for …

  7. c++ - Appending a vector to a vector - Stack Overflow

    Note that this is likely to be less efficient than using std::vector<>::insert(), because std::copy() can't reserve enough space before-hand (it doesn't have access to the vector itself, only to an …

  8. How do you copy the contents of an array to a std::vector in C++ ...

    How do you copy the contents of an array to a std::vector in C++ without looping? Asked 17 years, 1 month ago Modified 1 year, 2 months ago Viewed 275k times

  9. How to find out if an item is present in a std::vector?

    Feb 21, 2009 · You can use the find function, found in the std namespace, ie std::find. You pass the std::find function the begin and end iterator from the vector you want to search, along with …

  10. How do I erase an element from std::vector<> by index?

    Sadly, std::vector uses size_type for indexing, and difference_type for iterator arithmetic, so they don't work together if you have "-Wconversion" and friends enabled.