17 concept has_reserve_func = requires(T t) {
24 concept has_size_func = requires(T t) {
27 } -> std::convertible_to<size_t>;
34 class result_container_t,
35 class input_container_t,
36 class transform_callable_t,
37 class... result_container_rest_t>
38 auto transform_return(input_container_t&& input,
const transform_callable_t& transformCallable)
40 using result_type = decltype(transformCallable(*input.begin()));
41 using result_container_full_t = result_container_t<result_type, result_container_rest_t...>;
42 result_container_full_t result;
44 if constexpr (details::has_reserve_func<result_container_full_t> && details::has_size_func<input_container_t>)
45 result.reserve(input.size());
47 for (
auto&& inputElement : input)
48 result.insert(result.end(), transformCallable(std::forward<decltype(inputElement)>(inputElement)));