General Utility Library for C++14  2.11
Classes | Functions
gul14/SmallVector.h

Detailed Description

A vector with small-buffer optimization.

Classes

class  gul14::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 gul14::swap (SmallVector< ElementT, in_capacity > &a, SmallVector< ElementT, in_capacity > &b)
 Exchange the contents of one SmallVector with those of another one. More...
 

Function Documentation

◆ swap()

template<typename ElementT , size_t in_capacity>
void gul14::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 gul14::SmallVector< ElementT, in_capacity >::swap().