Avoid using indirect C++ types

This commit is contained in:
Rangi42
2025-04-23 00:53:20 -04:00
parent 762e2311d2
commit a72843748f
3 changed files with 12 additions and 14 deletions

View File

@@ -36,7 +36,7 @@ public:
// color), then the other color is returned. Otherwise, `nullptr` is returned.
[[nodiscard]]
Rgba const *registerColor(Rgba const &rgba) {
decltype(_colors)::value_type &slot = _colors[rgba.cgbColor()];
std::optional<Rgba> &slot = _colors[rgba.cgbColor()];
if (rgba.cgbColor() == Rgba::transparent) {
options.hasTransparentPixels = true;
@@ -52,7 +52,7 @@ public:
}
size_t size() const {
return std::count_if(RANGE(_colors), [](decltype(_colors)::value_type const &slot) {
return std::count_if(RANGE(_colors), [](std::optional<Rgba> const &slot) {
return slot.has_value() && !slot->isTransparent();
});
}