aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/types/IdentifierRegistry.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-08-26 00:25:12 +0200
committer Hop311 <hop3114@gmail.com>2023-09-03 12:53:52 +0200
commit366f1b3941315641bdcb0ee98465b4d2134eee86 (patch)
treeebb1e95b5e874c6eab09f19a323d721fd1fdac1b /src/openvic/types/IdentifierRegistry.cpp
parentefa88c722fcb6c8fea7a86e1b3b8a83f1f59eb31 (diff)
Followup big dataloader commit
Diffstat (limited to 'src/openvic/types/IdentifierRegistry.cpp')
-rw-r--r--src/openvic/types/IdentifierRegistry.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/openvic/types/IdentifierRegistry.cpp b/src/openvic/types/IdentifierRegistry.cpp
index 97a1ff5..3710387 100644
--- a/src/openvic/types/IdentifierRegistry.cpp
+++ b/src/openvic/types/IdentifierRegistry.cpp
@@ -35,3 +35,11 @@ HasIdentifierAndColour::HasIdentifierAndColour(const std::string_view new_identi
const colour_t new_colour, bool can_be_null)
: HasIdentifier { new_identifier },
HasColour { new_colour, can_be_null } {}
+
+distribution_t::value_type OpenVic::get_largest_item(distribution_t const& dist) {
+ const distribution_t::const_iterator result = std::max_element(dist.begin(), dist.end(),
+ [](distribution_t::value_type a, distribution_t::value_type b) -> bool {
+ return a.second < b.second;
+ });
+ return result != dist.end() ? *result : distribution_t::value_type { nullptr, -1.0f };
+}