Solved: 37 - Generic Lambdas
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user