Rumba C++ SDK
StackVector.h File Reference
#include "BufferAllocator.h"

Go to the source code of this file.

Namespaces

 maquina
 This version of the SDK is unstable, i-e, it may change with no warning.
 

Macros

#define STACK_VECTOR(name, T, size)
 Create a vector std::vector<T> name(size) on the stack initialized using stack memory. No heap allocation is performed. Regular allocations will be done if the vector capacity is increased. More...
 
#define STACK_VECTOR_VALUE(name, T, size, value)
 Create a vector std::vector<T> name(size, value) on the stack initialized using stack memory. No heap allocation is performed. Regular allocations will be done if the vector capacity is increased. More...
 
#define STACK_VECTOR_RESERVED(name, T, size)
 Create a vector std::vector<T> name() on the stack and reserve size objects into it. No heap allocation is performed. The vector is empty. Regular allocations will be done if the vector capacity is increased. More...
 
#define STACK_VECTOR_LIMIT(name, T, size, limit)
 Create a vector std::vector<T> name(size) on the stack initialized using stack memory, limited to 'limit' objects. No heap allocation is performed if size <= limit. Regular allocations will be done if the vector capacity is increased. More...
 
#define STACK_VECTOR_VALUE_LIMIT(name, T, size, value, limit)
 Create a vector std::vector<T> name(size, value) on the stack initialized using stack memory, limited to 'limit' objects. No heap allocation is performed if size <= limit. Regular allocations will be done if the vector capacity is increased. More...
 
#define STACK_VECTOR_RESERVED_LIMIT(name, T, size, limit)
 Create a vector std::vector<T> name() on the stack and reserve size objects into it. No heap allocation is performed if size <= limit. The vector is empty. Regular allocations will be done if the vector capacity is increased. More...
 

Macro Definition Documentation

◆ STACK_VECTOR

#define STACK_VECTOR (   name,
  T,
  size 
)
Value:
T* __##name##__ptr = (T*)alloca(sizeof(T)*size);\
std::vector<T, maquina::BufferAllocator<T>> name(size, maquina::BufferAllocator<T>(__##name##__ptr, size));
Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using ...
Definition: BufferAllocator.h:25

Create a vector std::vector<T> name(size) on the stack initialized using stack memory. No heap allocation is performed. Regular allocations will be done if the vector capacity is increased.

◆ STACK_VECTOR_LIMIT

#define STACK_VECTOR_LIMIT (   name,
  T,
  size,
  limit 
)
Value:
T* __##name##__ptr = (T*)alloca(sizeof(T)*std::min(size_t(size), size_t(limit)));\
std::vector<T, maquina::BufferAllocator<T>> name(size, maquina::BufferAllocator<T>(__##name##__ptr, std::min(size_t(size), size_t(limit))));
Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using ...
Definition: BufferAllocator.h:25

Create a vector std::vector<T> name(size) on the stack initialized using stack memory, limited to 'limit' objects. No heap allocation is performed if size <= limit. Regular allocations will be done if the vector capacity is increased.

◆ STACK_VECTOR_RESERVED

#define STACK_VECTOR_RESERVED (   name,
  T,
  size 
)
Value:
T* __##name##__ptr = (T*)alloca(sizeof(T)*size);\
std::vector<T, maquina::BufferAllocator<T>> name(maquina::BufferAllocator<T>(__##name##__ptr, size));\
name.reserve(size);
Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using ...
Definition: BufferAllocator.h:25

Create a vector std::vector<T> name() on the stack and reserve size objects into it. No heap allocation is performed. The vector is empty. Regular allocations will be done if the vector capacity is increased.

◆ STACK_VECTOR_RESERVED_LIMIT

#define STACK_VECTOR_RESERVED_LIMIT (   name,
  T,
  size,
  limit 
)
Value:
T* __##name##__ptr = (T*)alloca(sizeof(T)*std::min(size_t(size), size_t(limit)));\
std::vector<T, maquina::BufferAllocator<T>> name(maquina::BufferAllocator<T>(__##name##__ptr, std::min(size_t(size), size_t(limit))));\
name.reserve(size);
Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using ...
Definition: BufferAllocator.h:25

Create a vector std::vector<T> name() on the stack and reserve size objects into it. No heap allocation is performed if size <= limit. The vector is empty. Regular allocations will be done if the vector capacity is increased.

◆ STACK_VECTOR_VALUE

#define STACK_VECTOR_VALUE (   name,
  T,
  size,
  value 
)
Value:
T* __##name##__ptr = (T*)alloca(sizeof(T)*size);\
std::vector<T, maquina::BufferAllocator<T>> name(size, value, maquina::BufferAllocator<T>(__##name##__ptr, size));
Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using ...
Definition: BufferAllocator.h:25

Create a vector std::vector<T> name(size, value) on the stack initialized using stack memory. No heap allocation is performed. Regular allocations will be done if the vector capacity is increased.

◆ STACK_VECTOR_VALUE_LIMIT

#define STACK_VECTOR_VALUE_LIMIT (   name,
  T,
  size,
  value,
  limit 
)
Value:
T* __##name##__ptr = (T*)alloca(sizeof(T)*std::min(size_t(size), size_t(limit)));\
std::vector<T, maquina::BufferAllocator<T>> name(size, value, maquina::BufferAllocator<T>(__##name##__ptr, std::min(size_t(size), size_t(limit))));
Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using ...
Definition: BufferAllocator.h:25

Create a vector std::vector<T> name(size, value) on the stack initialized using stack memory, limited to 'limit' objects. No heap allocation is performed if size <= limit. Regular allocations will be done if the vector capacity is increased.