diff options
author | hop311 <hop3114@gmail.com> | 2024-07-21 15:09:25 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-07-22 20:21:27 +0200 |
commit | 67cbd14630c4344902d3fa1ddca178809da4293b (patch) | |
tree | 9df96829dd0f9a0bd7c2e6b0e047547aa4bff3a7 /src/openvic-simulation/types/HasIdentifier.hpp | |
parent | d1f3a96b72dd06b5f97dd4643e5f016a02b42ea6 (diff) |
Fleshing out Country, State and Province instances + historycountry-instance
Diffstat (limited to 'src/openvic-simulation/types/HasIdentifier.hpp')
-rw-r--r-- | src/openvic-simulation/types/HasIdentifier.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/openvic-simulation/types/HasIdentifier.hpp b/src/openvic-simulation/types/HasIdentifier.hpp index 925d58b..74961e3 100644 --- a/src/openvic-simulation/types/HasIdentifier.hpp +++ b/src/openvic-simulation/types/HasIdentifier.hpp @@ -2,6 +2,8 @@ #include <algorithm> #include <cassert> +#include <string> +#include <string_view> #include <ostream> #include "openvic-simulation/types/Colour.hpp" @@ -49,6 +51,11 @@ namespace OpenVic { return obj != nullptr ? stream << *obj : stream << "<NULL>"; } + template<typename T> + concept HasGetIdentifier = requires(T const& t) { + { t.get_identifier() } -> std::same_as<std::string_view>; + }; + /* * Base class for objects with associated colour information. */ @@ -71,6 +78,11 @@ namespace OpenVic { using HasColour = _HasColour<colour_t>; using HasAlphaColour = _HasColour<colour_argb_t>; + template<typename T> + concept HasGetColour = requires(T const& t) { + { t.get_colour() } -> IsColour; + }; + /* * Base class for objects with a unique string identifier and associated colour information. */ @@ -107,4 +119,9 @@ namespace OpenVic { HasIndex& operator=(HasIndex const&) = delete; HasIndex& operator=(HasIndex&&) = delete; }; + + template<typename T> + concept HasGetIndex = requires(T const& t) { + { t.get_index() } -> std::unsigned_integral; + }; } |