warmte / vector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vector

Dynamic array (aka vector) with small-object and copy-on-write optimizations. The project includes C++ optimized vector library, unit tests, integration tests and exception safety tests.

Implementation requirements

  • Small-object optimization: when the vector is small enough, its data should be kept in a static buffer. This optimization helps to avoid too many memory reallocations for the small arrays.
  • Copy-on-write optimization: when the vector is copied the copy should only store the link to the original array and allocate more memory only during the update of its content.
  • The amount of memory allowed for the one vector's instance is calculated by the formula: sizeof(vector) <= max(2sizeof(void), sizeof(void*) + sizeof(T))
  • It's restricted to allocate more than one piece of memory at the same time.
  • It's possible that T doesn't have a default constructor.
  • Exception guarantees:
    • base for insert and erase
    • noexcept for all the const methods
    • strong otherwise

About


Languages

Language:C++ 98.6%Language:CMake 1.4%