diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-01-01 04:32:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 04:32:01 +0100 |
commit | 9988b21278dc1c8df044631bd2935a7e450a7bff (patch) | |
tree | ba081f9f4d74865ab5851a2efd560745900ca81a /src/openvic-simulation/misc/Modifier.cpp | |
parent | 0a425fbe05d6138b753c0e4a7c06f06695bde8af (diff) | |
parent | e1496a87178d925277aceed0ebcbab06920e15ee (diff) |
Merge pull request #105 from OpenVicProject/add/ordered-map
Diffstat (limited to 'src/openvic-simulation/misc/Modifier.cpp')
-rw-r--r-- | src/openvic-simulation/misc/Modifier.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/openvic-simulation/misc/Modifier.cpp b/src/openvic-simulation/misc/Modifier.cpp index c86b121..94d38e0 100644 --- a/src/openvic-simulation/misc/Modifier.cpp +++ b/src/openvic-simulation/misc/Modifier.cpp @@ -1,6 +1,10 @@ #include "Modifier.hpp" + #include <string> +#include "openvic-simulation/types/OrderedContainers.hpp" +#include "openvic-simulation/utility/TslHelper.hpp" + using namespace OpenVic; using namespace OpenVic::NodeTools; @@ -16,7 +20,7 @@ ModifierValue& ModifierValue::operator=(ModifierValue const&) = default; ModifierValue& ModifierValue::operator=(ModifierValue&&) = default; void ModifierValue::trim() { - std::erase_if(values, [](effect_map_t::value_type const& value) -> bool { + erase_if(values, [](effect_map_t::value_type const& value) -> bool { return value.second == fixed_point_t::_0(); }); } @@ -57,7 +61,7 @@ ModifierValue ModifierValue::operator+(ModifierValue const& right) const { ModifierValue ModifierValue::operator-() const { ModifierValue ret = *this; - for (effect_map_t::value_type& value : ret.values) { + for (auto value : mutable_iterator(ret.values)) { value.second = -value.second; } return ret; |