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:
OusmBlueNinja 2025-06-02 13:00:36 -05:00
parent 656f1c070f
commit 626e8b2b71
3 changed files with 4 additions and 5 deletions

View File

@ -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})

View File

@ -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;

View File

@ -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.