Added missing dependency to yaml-cpp and added count parameter to ConfigArray::removeAt().

This commit is contained in:
Patrick Wuttke 2025-09-22 21:45:47 +02:00
parent 20020318e1
commit 9d02d97af3
3 changed files with 7 additions and 4 deletions

View File

@ -13,5 +13,6 @@
"SDL": {
"min": [3,0,0]
},
"stb": {}
"stb": {},
"yaml-cpp": {}
}

View File

@ -137,9 +137,11 @@ void ConfigArray::setAt(std::size_t idx, ConfigValue value)
mValues[idx] = std::move(value);
}
void ConfigArray::removeAt(std::size_t idx)
void ConfigArray::removeAt(std::size_t idx, std::size_t count)
{
mValues.erase(mValues.begin() + static_cast<std::ptrdiff_t>(idx));
auto itStart = mValues.begin() + static_cast<std::ptrdiff_t>(idx);
auto itEnd = itStart + static_cast<std::ptrdiff_t>(count);
mValues.erase(itStart, itEnd);
}

View File

@ -46,7 +46,7 @@ public:
void append(ConfigValue value);
void setAt(std::size_t idx, ConfigValue value);
void removeAt(std::size_t idx);
void removeAt(std::size_t idx, std::size_t count = 1);
[[nodiscard]]
bool isEmpty() const noexcept { return mValues.empty(); }