mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 14:30:41 +08:00
Added grep method for containers (returns a new copy of the container that returns true for the lambda function).
This commit is contained in:
parent
23793a6765
commit
ef37a748ff
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user