gz-cpp-util 1.3
A c++20 library containing various utilities
|
Various utilites. More...
#include <concepts>
Go to the source code of this file.
Functions | |
template<std::unsigned_integral I, std::unsigned_integral S> | |
void | gz::util::incrementIndex (I &i, const S containerSize) |
Increment an index. Up to containerSize, then restart at 0. | |
template<std::unsigned_integral I, std::unsigned_integral S> | |
void | gz::util::decrementIndex (I &i, const S containerSize) |
Decrement an index. Down to 0, then restart at containerSize - 1. | |
template<std::unsigned_integral I, std::unsigned_integral S> | |
I | gz::util::getIncrementedIndex (const I i, const S containerSize) |
Like incrementIndex, but returns a new number. | |
template<std::unsigned_integral I, std::unsigned_integral S> | |
I | gz::util::getDecrementedIndex (const I i, const S containerSize) |
Like decrementIndex, but returns a new number. | |
template<std::integral I, std::unsigned_integral S> | |
std::size_t | gz::util::getValidIndex (const I i, const S containerSize) |
Wrap an index around, to make it valid. More... | |
Various utilites.
std::size_t gz::util::getValidIndex | ( | const I | i, |
const S | containerSize | ||
) |
Wrap an index around, to make it valid.
Example: