SkillAgentSearch skills...

Vector

A sequence container similar to the C++ std::vector, but instead of allocating memory dynamically, this container points to an external, statically allocated c style array.

Install / Use

/learn @janelia-arduino/Vector
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

#+TITLE: Vector #+AUTHOR: Peter Polidoro #+EMAIL: peter@polidoro.io

  • Library Information

    • Name :: Vector
    • Version :: 1.2.2
    • License :: BSD
    • URL :: https://github.com/janelia-arduino/Vector
    • Author :: Peter Polidoro
    • Email :: peter@polidoro.io

    A sequence container similar to the C++ [[http://www.cplusplus.com/reference/vector/vector/][std::vector]], but instead of allocating memory dynamically, this container points to an external, statically allocated c style array. The maximum size is fixed at compile time, but the size can change by pushing and popping elements from the vector. Static memory allocation is used to avoid dynamic allocation problems on very small embedded processors. Care must be taken not to dereference an empty vector, access elements beyond bounds, or use without setting the storage array.

    This library is very similar to [[https://github.com/janelia-arduino/Array][Array]], however Array stores data internally in the container and this library stores data externally. The pointer to the external memory causes this container to use more memory than the Array container, but storing the data externally avoids needing the maximum size as a class template parameter.

  • Vector vs Array ** Vector

    #+BEGIN_SRC C++ const int ELEMENT_COUNT_MAX = 5; int storage_array[ELEMENT_COUNT_MAX]; Vector<int> vector(storage_array); vector.push_back(77); #+END_SRC

** Array

#+BEGIN_SRC C++ const int ELEMENT_COUNT_MAX = 5; Array<int,ELEMENT_COUNT_MAX> array; array.push_back(77); #+END_SRC

View on GitHub
GitHub Stars110
CategoryDevelopment
Updated20d ago
Forks19

Languages

C++

Security Score

80/100

Audited on Mar 4, 2026

No findings