diff options
author | hop311 <hop3114@gmail.com> | 2023-10-13 00:05:49 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-10-13 00:05:49 +0200 |
commit | 6b3d2315225468e03bef30e942263fe9b8fc06fa (patch) | |
tree | fbcc59a1637cd13a0024ed1c8ff17dcf2e1a6ed7 /src/openvic-simulation/types | |
parent | e50c67eb1aaa54f5fb31425f81616bea4e6b880a (diff) |
Further cleanup and rearrangement
Diffstat (limited to 'src/openvic-simulation/types')
-rw-r--r-- | src/openvic-simulation/types/IdentifierRegistry.hpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp index 4e13813..aea5728 100644 --- a/src/openvic-simulation/types/IdentifierRegistry.hpp +++ b/src/openvic-simulation/types/IdentifierRegistry.hpp @@ -6,6 +6,10 @@ #include "openvic-simulation/dataloader/NodeTools.hpp" #include "openvic-simulation/utility/Logger.hpp" +#define REF_GETTERS(var) \ + constexpr decltype(var)& get_##var() { return var; } \ + constexpr decltype(var) const& get_##var() const { return var; } + namespace OpenVic { /* * Base class for objects with a non-empty string identifier, @@ -179,13 +183,7 @@ namespace OpenVic { return get_item_by_index(index) != nullptr; } - std::vector<storage_type>& get_items() { - return items; - } - - std::vector<storage_type> const& get_items() const { - return items; - } + REF_GETTERS(items) std::vector<std::string_view> get_item_identifiers() const { std::vector<std::string_view> identifiers; |