Solved: 37 - Generic Lambdas

This commit is contained in:
2026-08-22 09:09:20 +03:00
parent 9928855c1e
commit 40387c9218
+9 -4
View File
@@ -1,16 +1,21 @@
#include "generic_lambdas.hpp" #include "generic_lambdas.hpp"
#include <algorithm>
namespace cpp14 { namespace cpp14 {
auto apply_twice(const std::vector<int>& values) -> std::vector<int> { auto apply_twice(const std::vector<int>& values) -> std::vector<int> {
(void)values; auto r = std::vector<int>(values.size());
return {}; std::ranges::transform(values, r.begin(), [](auto x) { return x * 2; });
return r;
} }
auto concat_any(const std::vector<std::string>& a, const std::vector<std::string>& b) auto concat_any(const std::vector<std::string>& a, const std::vector<std::string>& b)
-> std::vector<std::string> { -> std::vector<std::string> {
(void)a; (void)b; auto r = std::vector<std::string>(a.size() + b.size());
return {}; std::ranges::transform(a, r.begin(), [](auto x) { return x; });
std::ranges::transform(b, r.begin() + a.size(), [](auto x) { return x; });
return r;
} }
} // namespace cpp14 } // namespace cpp14