Added grep method for containers (returns a new copy of the container that returns true for the lambda function).

This commit is contained in:
Joseph Lenox 2018-11-17 20:55:17 -06:00 committed by Joseph Lenox
parent 23793a6765
commit ef37a748ff

View File

@ -177,6 +177,14 @@ public:
}
};
/// Quick implementation of grep to filter containers based on some lambda function.
template<class T, class G>
T grep(const T& container, G lambda_func) {
T result;
std::copy_if(container.cbegin(), container.cend(), std::back_inserter(result), lambda_func);
return result;
}
}} // namespace Slic3r::GUI
#endif // MISC_UI_HPP