9 std::vector<unsigned long long> persistent{0, 1, 1, 2, 3, 5, 8};
12 auto& v = std::get<0>(t);
13 auto i =
static_cast<int>(std::get<1>(t));
17 SECTION(
"const lvalue") {
18 const auto& cp = persistent;
20 auto& v = std::get<0>(t);
21 auto i =
static_cast<int>(std::get<1>(t));
25 typename std::remove_reference<
decltype(v)>::type>::value,
26 "v must refer to const when the range is const");
30 SECTION(
"iterators") {
32 auto& v = std::get<0>(t);
33 auto i =
static_cast<int>(std::get<1>(t));
37 SECTION(
"mutable iterators") {
38 std::vector<int>
range{0, 1, 2, 3, 4, 5, 6, 7};
40 auto& v = std::get<0>(t);
41 [[gnu::unused]]
auto& i = std::get<1>(t);
45 [](
int v) { return v == 0; }));
47 SECTION(
"reverse iterators") {
48 std::vector<std::size_t> reversed{7, 6, 5, 4, 3, 2, 1, 0};
50 auto& v = std::get<0>(t);
51 auto& i = std::get<1>(t);
56 SECTION(
"temporary") {
58 std::vector<unsigned long long>{0, 1, 1, 2, 3, 5, 8})) {
59 auto& v = std::get<0>(t);
60 auto i =
static_cast<int>(std::get<1>(t));
64 SECTION(
"vector<bool>") {
66 std::vector<bool>{
false,
true,
false,
true,
false})) {
67 auto& v = std::get<0>(t);
68 auto& i = std::get<1>(t);
78 static_assert(std::is_same<
decltype(dangling),
int&&>::value,
"");
82 static_assert(std::is_same<
decltype(safe),
int>::value,
"");
constexpr struct kblib::nums::min_t min
constexpr auto fibonacci(int n) noexcept -> U
Compile-time table fibonacci function.
auto safe_auto(T &&in) -> T
Safely propagate an xvalue or lvalue without dangling references.
constexpr auto range(Value min, Value max, Delta step=0) -> range_t< Value, Delta >
Constructs a range from beginning, end, and step amount. The range is half-open, that is min is in th...
constexpr auto all_of(InputIt begin, InputIt end, UnaryPredicate pred) -> enable_if_t< is_input_iterator< InputIt >::value, bool >
Determine if pred is true for every element of the range.
constexpr auto enumerate(Range &&r) -> enumerate_t< Range && >
Allow access to indexes while using range-based for loops. Safe to use with rvalues.
Provides general utilities which do not fit in any more specific header.
Provides numerical and mathematical utilities.
#define KBLIB_UNUSED
This internal macro is used to provide a fallback for [[maybe_unused]] in C++14.