write shit

This commit is contained in:
2023-09-20 10:49:32 +08:00
parent 69f702a6d2
commit d66716acd7
14 changed files with 178 additions and 348 deletions

View File

@ -144,10 +144,13 @@ namespace LibCmo::XContainer {
}
namespace NSXObjectPointerArray {
void AddIfNotHere(XObjectPointerArray& objarray, CK2::ObjImpls::CKObject* const obj) {
bool AddIfNotHere(XObjectPointerArray& objarray, CK2::ObjImpls::CKObject* const obj) {
auto finder = std::find(objarray.begin(), objarray.end(), obj);
if (finder == objarray.end()) {
objarray.emplace_back(obj);
return true;
} else {
return false;
}
}

View File

@ -181,11 +181,12 @@ namespace LibCmo::XContainer {
namespace NSXObjectPointerArray {
/**
* @brief Add object pointer if it is not list.
* @brief Inserts the object at the end of the array, if it is not yet present.
* @param objarray
* @param obj
* @return True if the object was already present, false otherwise
*/
void AddIfNotHere(XObjectPointerArray& objarray, CK2::ObjImpls::CKObject* const obj);
bool AddIfNotHere(XObjectPointerArray& objarray, CK2::ObjImpls::CKObject* const obj);
/**
* @brief Check Object pointer validation and remove invalid pointers before deletion.