HTTP server networking side, also, fix the releasing of channels in driver
This commit is contained in:
@@ -221,11 +221,17 @@ double distance_squared(double x1, double y1, double x2, double y2);
|
||||
// Make a LuaSourceVec with one element, for unit testing.
|
||||
LuaSourcePtr make_lua_source(const eng::string &code);
|
||||
|
||||
// Remove nullptrs from a vector of unique pointers.
|
||||
// Remove items from a vector that are nullptr.
|
||||
template<class T>
|
||||
void remove_nullptrs(eng::vector<std::unique_ptr<T>> &vec) {
|
||||
std::unique_ptr<T> nullp;
|
||||
auto iter = std::remove(vec.begin(), vec.end(), nullp);
|
||||
void remove_nullptrs(T &vec) {
|
||||
auto iter = std::partition(vec.begin(), vec.end(), [] (const auto &x) { return x != nullptr; });
|
||||
vec.erase(iter, vec.end());
|
||||
}
|
||||
|
||||
// Remove items from a vector that are marked for deletion.
|
||||
template<class T>
|
||||
void remove_marked_items(T &vec) {
|
||||
auto iter = std::partition(vec.begin(), vec.end(), [] (const auto &x) { return !x.marked_for_deletion(); });
|
||||
vec.erase(iter, vec.end());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user