Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes
static_vector.hpp File Reference

Defines static_vector, a fixed-capacity, stack-allocated vector with a std::vector-like API. More...

#include <cstddef>
#include <iterator>
#include <stdexcept>
#include <type_traits>
#include <uni20/common/trace.hpp>
#include <utility>
Include dependency graph for static_vector.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  static_vector< T, MaxSize >
 A fixed-capacity vector with stack storage and std::vector-like API. More...
 
class  static_vector< T, 0 >
 Specialization of static_vector for MaxSize == 0. More...
 

Detailed Description

Defines static_vector, a fixed-capacity, stack-allocated vector with a std::vector-like API.

static_vector<T, N> is a lightweight container that avoids heap allocation by storing elements in a statically allocated buffer of capacity N. It supports in-place construction and destruction of elements up to N and provides the usual accessors and iterators. To get bounds checking compile with DEBUG options to get precondtion checks. A specialization for MaxSize == 0 exists to allow seamless use in generic code.