About 50 results
Open links in new tab
  1. How to call vector function from main() in C++? - Stack Overflow

    Dec 3, 2020 · 2 In C++, you can't create a std::vector with a [1, 2] expression. The most similar thing will be implicitly creating an instance of std::vector by list initializer with {1, 2}. See more about this in …

  2. Why use a new call with a C++ 'vector'? - Stack Overflow

    Feb 13, 2018 · So how is the following, vector<someType> *myVector = new vector<someType>();, different (other than being a pointer) from the earlier one? Is there a double allocation happening …

  3. stl - Why is a C++ Vector called a Vector? - Stack Overflow

    Feb 24, 2009 · It's called a vector because Alex Stepanov, the designer of the Standard Template Library, was looking for a name to distinguish it from built-in arrays. He admits now that he made a …

  4. Should I always call vector clear() at the end of the function?

    Feb 5, 2014 · 1 You can omit using the .clear () function because vector's destructor runs once contentVector goes out of scope at the '}'. This deallocates the memory that stores vector's data.

  5. C++ Destructors with Vectors, Pointers, - Stack Overflow

    Aug 22, 2012 · std::vector<myClass*> of pointers to classes. What happens when the vector destructor is called? Would it call automatically the destructor of myClass? Or only the vector is destroyed but …

  6. Calling a function on every element of a C++ vector

    May 9, 2012 · In C++, is there a way to call a function on each element of a vector, without using a loop running over all vector elements? Something similar to a 'map' in Python.

  7. c++11 vector initialization in a function call - Stack Overflow

    Dec 20, 2012 · data = vector< vector<int> >(); is totally superfluous and might point out a fundamental misunderstanding in C++ constructors and initialization.

  8. error: no matching function for call to ‘std::vector<std::vector<int ...

    Jul 24, 2019 · I am trying to debug this code from my supervisor and I'm new to C++. I found a few similar no matching function for call to questions, which gave me ideas what the problem might be …

  9. how does std::vector deal with the call to destructor?

    Nov 29, 2022 · I wonder how does std::vector deal with the call to destructor. I found, only when the type is a build-in pointer won't std::vector call the destructor (Of course if it have one). Does std::vector …

  10. error: no matching function for call to ‘std::vector<std::__cxx11 ...

    Jun 27, 2018 · 3 You are reading int variable m and trying to put it into a vector of strings. You should use std::vector<int> instead. Bottom line: your code needs only one change, most reasonable one …