aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Modifier.cpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-12-25 08:42:11 +0100
committer Spartan322 <Megacake1234@gmail.com>2023-12-31 20:46:26 +0100
commite1496a87178d925277aceed0ebcbab06920e15ee (patch)
treeba081f9f4d74865ab5851a2efd560745900ca81a /src/openvic-simulation/misc/Modifier.cpp
parent0a425fbe05d6138b753c0e4a7c06f06695bde8af (diff)
Add `https://github.com/Tessil/ordered-map`
Add is_specialization_of to Utility.hpp Add OpenVic::ordered_map and OpenVic::ordered_set Change `std::map` to `ordered_map` Change `std::set to use `ordered_set` Add `set_callback_pointer(tsl::ordered_set<T const*>& set)` Add mutable_iterator to enable mutable value iterator for `tsl::ordered_map` Add std::hash<OpenVic::Date> implementation Enable deps/SCsub to expose dependency includes neccessary for inclusion
Diffstat (limited to 'src/openvic-simulation/misc/Modifier.cpp')
-rw-r--r--src/openvic-simulation/misc/Modifier.cpp8
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;