Template Class static_vector

Class Documentation

template<class T>
class static_vector

Static vector which only allocated memory on construction. Copying this vector is not possible as this would require additional memory.

Template Parameters:

T – Type to store in the vector.

Public Functions

inline explicit static_vector(const size_type capacity)

Creates an empty vector.

Parameters:

capacity – Capacity of the vector meaning the maximum number of elements it can hold.

template<class IT>
inline explicit static_vector(const size_type capacity, const IT first, const IT last)

Constructs the container with the contents of the range [first, last).

Parameters:
  • capacity – Capacity of the vector meaning the maximum number of elements it can hold.

  • first – Begin of the iterator.

  • last – End of the iterator.

Template Parameters:

IT – Iterator type.

inline explicit static_vector(const size_type capacity, std::initializer_list<value_type> il)

Constructs the container from an initialization list.

Parameters:
  • capacity – Capacity of the vector meaning the maximum number of elements it can hold.

  • il – Initialization list to copy to the vector.

static_vector(const static_vector<T> &other) = delete
inline static_vector<T> &operator=(const static_vector<T> &other)

Assignment operator.

inline static_vector(static_vector<T> &&other) noexcept

Move constructor.

inline static_vector<T> &operator=(static_vector<T> &&other) noexcept

Move assignment.

inline void shrink_to_fit()

Noop. This is just implemented for compatibility reasons.

inline void swap(static_vector<T> &x)

Exchanges the content of the container by the content another vector object of the same type. Sizes may differ.

Parameters:

x – The vector to swap with.

Friends

template<class K>
friend bool operator==(const static_vector<K> &lhs, const static_vector<K> &rhs)
template<class K>
friend bool operator!=(const static_vector<K> &lhs, const static_vector<K> &rhs)
template<class K>
friend bool operator<(const static_vector<K> &lhs, const static_vector<K> &rhs)
template<class K>
friend bool operator<=(const static_vector<K> &lhs, const static_vector<K> &rhs)
template<class K>
friend bool operator>(const static_vector<K> &lhs, const static_vector<K> &rhs)
template<class K>
friend bool operator>=(const static_vector<K> &lhs, const static_vector<K> &rhs)