Modernizes root object removal
Uses `std::ranges::find_if` for searching in `removeRootObject`, modernizing the code. Removes an unnecessary comment in CMakeLists.txt. Simplifies a comment in the Scene.h header file.
This commit is contained in:
parent
656f1c070f
commit
626e8b2b71
@ -29,7 +29,6 @@ include_directories(${CMAKE_BINARY_DIR}/generated)
|
||||
|
||||
|
||||
|
||||
# --- Output directories for multi-config builds ---
|
||||
foreach(OUTPUTCONFIG IN ITEMS Debug Release)
|
||||
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG_UPPER)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UPPER} ${CMAKE_BINARY_DIR}/bin/${OUTPUTCONFIG})
|
||||
|
@ -14,10 +14,10 @@ namespace OX
|
||||
|
||||
bool Scene::removeRootObject(GameObject *go)
|
||||
{
|
||||
auto it = std::find_if(
|
||||
m_roots.begin(), m_roots.end(),
|
||||
[go](const std::unique_ptr<GameObject> &u) { return u.get() == go; }
|
||||
auto it = std::ranges::find_if(m_roots,
|
||||
[go](const std::unique_ptr<GameObject> &u) { return u.get() == go; }
|
||||
);
|
||||
|
||||
if (it == m_roots.end())
|
||||
return false;
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace OX
|
||||
|
||||
~Scene() = default;
|
||||
|
||||
/// Create and own a new root GameObject. Returns the raw pointer.
|
||||
/// Create a new root GameObject. Returns the raw pointer.
|
||||
GameObject *createRootObject(const std::string &name = "");
|
||||
|
||||
/// Remove (and destroy) a root object by pointer.
|
||||
|
Loading…
Reference in New Issue
Block a user