General Utility Library for C++17 25.4.1
Classes | Functions
gul17/SmallVector.h

Detailed Description

A vector with small-buffer optimization.

Classes

class  gul17::SmallVector< ElementT, in_capacity >
 A resizable container with contiguous storage that can hold a specified number of elements without allocating memory on the heap. More...
 

Functions

template<typename ElementT , size_t in_capacity>
void gul17::swap (SmallVector< ElementT, in_capacity > &a, SmallVector< ElementT, in_capacity > &b)
 Exchange the contents of one SmallVector with those of another one.
 

Function Documentation

◆ swap()

template<typename ElementT , size_t in_capacity>
void gul17::swap ( SmallVector< ElementT, in_capacity > &  a,
SmallVector< ElementT, in_capacity > &  b 
)

Exchange the contents of one SmallVector with those of another one.

If either this or the other vector have internally stored elements (capacity() <= inner_capacity()), this function falls back to element-wise swapping. Otherwise, the heap-allocated buffers are swapped directly.

References gul17::bit_set().