Learned yesterday that you can do a multi-return assing to auto[] by just returning a struct.

This commit is contained in:
Zed A. Shaw 2024-11-01 00:40:04 -04:00
parent 3394327981
commit a44a9a04f9
2 changed files with 8 additions and 4 deletions

View file

@ -41,7 +41,7 @@ inline void find_neighbor(const PointEntityMap &table, EntityList &result, Point
}
}
std::tuple<bool, EntityList> spatial_map::neighbors(Point cell, bool diag) const {
FoundEntities spatial_map::neighbors(Point cell, bool diag) const {
EntityList result;
// just unroll the loop since we only check four directions
@ -58,5 +58,5 @@ std::tuple<bool, EntityList> spatial_map::neighbors(Point cell, bool diag) const
find_neighbor(table, result, cell, -1, 1); // north west
}
return std::tuple(!result.empty(), result);
return {!result.empty(), result};
}