1#ifndef TATOOINE_ALGORITHM_H
2#define TATOOINE_ALGORITHM_H
8template <
typename Range,
typename RangeIt>
10 std::size_t new_prev_size) {
13 static_cast<int>(new_prev_size) -
static_cast<int>(prev_size);
14 if (size_change > 0) {
15 for (std::size_t i = 0; i < static_cast<std::size_t>(size_change); ++i) {
18 }
else if (size_change < 0) {
24template <
typename Range,
typename RangeIt>
26 std::size_t new_next_size) {
29 static_cast<int>(new_next_size) -
static_cast<int>(next_size);
30 if (size_change > 0) {
31 for (std::size_t i = 0; i < static_cast<std::size_t>(size_change); ++i) {
34 }
else if (size_change < 0) {
40constexpr auto clamp(
const T& v,
const T& lo,
const T& hi) ->
const T& {
42 return (v < lo) ? lo : (hi < v) ? hi : v;
45template <
typename T,
typename Compare>
46constexpr auto clamp(
const T& v,
const T& lo,
const T& hi, Compare comp)
48 assert(!comp(hi, lo));
49 return comp(v, lo) ? lo : comp(hi, v) ? hi : v;
Definition: concepts.h:84
Definition: algorithm.h:6
constexpr auto distance(Iter const &it0, Iter const &it1)
Definition: iterator_facade.h:372
auto begin(Range &&range)
Definition: iterator_facade.h:318
auto end(Range &&range)
Definition: iterator_facade.h:322
auto next(Iter iter)
Definition: iterator_facade.h:325
decltype(auto) resize_next_list(Range &range, RangeIt pos, std::size_t new_next_size)
Definition: algorithm.h:25
constexpr auto clamp(const T &v, const T &lo, const T &hi) -> const T &
Definition: algorithm.h:40
decltype(auto) resize_prev_list(Range &range, RangeIt pos, std::size_t new_prev_size)
Definition: algorithm.h:9
auto prev(Iter iter)
Definition: iterator_facade.h:343