functional.hpp
Created 2025-08-21T06:54:17.304Z, last edited 2025-08-28T10:00:06.159Z
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #pragma once #include <cstddef> template<typename Lambda> constexpr inline auto by_index( std::size_t const start_index, std::size_t const max_index, Lambda &&lambda) { for (std::size_t index{start_index}; index < max_index; ++index) { lambda(index); } } template<typename Lambda> constexpr inline auto by_index(std::size_t const max_index, Lambda &&lambda) { return by_index({}, max_index, std::forward<Lambda>(lambda)); } |
© 2002-2026 Kirit & Tai Sælensminde. All forum posts are copyright their respective authors.
Licensed under a Creative Commons License. Non-commercial use is fine so long as you provide attribution.

