// License: Modified MIT (NON-AI) // See the LICENSE file in the root directory for license information. // Copyright 2025 Timothy Prepscius #pragma once #include #include namespace tjp::core::io { template void call_f_1s(F&& f, Args&&... args) { (f(std::forward(args)), ...); } template void call_f_2s_(F &&f, Tuple&& tup, std::index_sequence) { (f( std::forward(std::forward(tup)))>( std::get(std::forward(tup))), std::forward(std::forward(tup)))>( std::get(std::forward(tup))) ), ...); } template void call_f_2s(F &&f, Args&&... args) { static_assert(sizeof...(Args) % 2 == 0, "Arguments must be in key-value pairs"); auto args_tuple = std::forward_as_tuple(std::forward(args)...); constexpr std::size_t N = sizeof...(Args) / 2; call_f_2s_(std::forward(f), args_tuple, std::make_index_sequence{}); } } // namespace