23 lines
507 B
C++
23 lines
507 B
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <string>
|
|
|
|
// Simple static vector (much faster)
|
|
// Also slightly faster than boost::container::static_vector
|
|
// No checking is performed!
|
|
template <typename T, size_t Max>
|
|
struct small_vector{
|
|
std::array<T, Max> arr;
|
|
size_t elements = 0;
|
|
|
|
void push_back(T const & t){
|
|
arr[elements++] = t;
|
|
}
|
|
|
|
auto begin() const { return &arr[0]; }
|
|
auto end() const { return &arr[elements]; }
|
|
};
|
|
|
|
// Generates color codes for the terminal
|
|
std::string colored_block(int color);
|