1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
puzzle-wuzzle-generator/include/utilities.hpp
2014-03-04 15:32:21 +01:00

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);