diff options
author | Hop311 <Hop3114@gmail.com> | 2024-07-23 19:47:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-23 19:47:47 +0200 |
commit | 6cd55c452d1643666ff4169a89402fd3e3b66c61 (patch) | |
tree | 888b847a54c66b6e9d1b2f7ee3e3d0f8071eceda /src/openvic-simulation/types/IndexedMap.hpp | |
parent | 9d57ca273e4b32ab82a51789ec58e08fefb5276a (diff) | |
parent | 67cbd14630c4344902d3fa1ddca178809da4293b (diff) |
Merge pull request #177 from OpenVicProject/country-instance
Fleshing out Country, State and Province instances + history
Diffstat (limited to 'src/openvic-simulation/types/IndexedMap.hpp')
-rw-r--r-- | src/openvic-simulation/types/IndexedMap.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/openvic-simulation/types/IndexedMap.hpp b/src/openvic-simulation/types/IndexedMap.hpp index 68effb9..30cf5cd 100644 --- a/src/openvic-simulation/types/IndexedMap.hpp +++ b/src/openvic-simulation/types/IndexedMap.hpp @@ -14,6 +14,8 @@ namespace OpenVic { using container_t = std::vector<Value>; using key_t = Key; using value_t = Value; + using value_ref_t = container_t::reference; + using value_const_ref_t = container_t::const_reference; using keys_t = std::vector<key_t>; using container_t::operator[]; @@ -91,11 +93,11 @@ namespace OpenVic { } } - constexpr value_t& operator[](key_t const& key) { + constexpr value_ref_t operator[](key_t const& key) { return container_t::operator[](get_index_from_item(key)); } - constexpr value_t const& operator[](key_t const& key) const { + constexpr value_const_ref_t operator[](key_t const& key) const { return container_t::operator[](get_index_from_item(key)); } |