Added namespace prefixes

This commit is contained in:
Bob Polis 2022-11-01 11:39:09 +01:00
parent e44b5c79c3
commit e125cbe4fe

View File

@ -21,14 +21,14 @@ namespace sc {
template<class T, class M> template<class T, class M>
std::vector<M> map(const std::vector<T>& seq, std::function<M(T)> fun) { std::vector<M> map(const std::vector<T>& seq, std::function<M(T)> fun) {
std::vector<M> result; std::vector<M> result;
std::transform(seq.begin(), seq.end(), back_inserter(result), fun); std::transform(seq.begin(), seq.end(), std::back_inserter(result), fun);
return result; return result;
} }
template<class T> template<class T>
std::vector<T> filter(const std::vector<T>& seq, std::function<bool(T)> fun) { std::vector<T> filter(const std::vector<T>& seq, std::function<bool(T)> fun) {
std::vector<T> result; std::vector<T> result;
std::copy_if(seq.begin(), seq.end(), back_inserter(result), fun); std::copy_if(seq.begin(), seq.end(), std::back_inserter(result), fun);
return result; return result;
} }