About 50 results
Open links in new tab
  1. c++ - What is the easiest way to initialize a std::vector with ...

    Feb 10, 2010 · But you are right that if you want to initialize an empty vector and a non-empty vector you will have to use different constructs. Since C++11 this is a non-issue as you can use the initializer list …

  2. 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 a point in a …

  3. c++ - Constant-sized vector - Stack Overflow

    Jun 21, 2012 · 76 There is no way to define a constant size vector. If you know the size at compile time, you could use C++11's std::array aggregate.

  4. c++ - Declaring a 2D vector - Stack Overflow

    61 std::vector has a fill constructor which creates a vector of n elements and fills with the value specified. a has the type std::vector<std::vector<int>> which means that it is a vector of a vector. Hence your …

  5. c++ - Initialisation of static vector - Stack Overflow

    Sep 13, 2010 · I wonder if there is the "nicer" way of initialising a static vector than below?

  6. C++ vector of char array - Stack Overflow

    The vector of vectors fits many purposes, but is not the answer and in some cases it is just wrong. Is an unpleasant experience to fall in the trap of fixing errors caused by not understanding clearly the …

  7. How to define a vector with undefined size - Stack Overflow

    The vector class doesn't have a pre-defined size; as you add member objects, the size of the vector grows dynamically. It might be worthwhile to read about standard C++ library in general and vector in …

  8. c++ - Initialize a vector array of strings - Stack Overflow

    Would it be possible to initialize a vector array of strings? for example: static std::vector&lt;std::string&gt; v; //declared as a class member I used static just to initialize and fill it with s...

  9. gcc - Understanding this C syntax for ARM Cortex-M interrupt vector ...

    Jun 18, 2021 · A vector table is essentially just an array of ISR addresses. Which translated to C can be regarded as an array of function pointers. Creating the vector table as an array of function pointers is …

  10. How to declare an array of strings in C++? - Stack Overflow

    Jan 28, 2016 · I am trying to iterate over all the elements of a static array of strings in the best possible way. I want to be able to declare it on one line and easily add/remove elements from it without having...