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 <algorithm>
namespace cpp14 {
auto apply_twice(const std::vector<int>& values) -> std::vector<int> {
(void)values;
return {};
auto r = std::vector<int>(values.size());
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)
-> std::vector<std::string> {
(void)a; (void)b;
return {};
auto r = std::vector<std::string>(a.size() + b.size());
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