diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-22 17:57:47 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-22 17:57:47 +0100 |
commit | 38d7045685d4904d013ea4990a3aa7f5e78309cf (patch) | |
tree | 60915147de5e37dc4a3fab39408b6abbfc49ce09 /lib/stream_support.hpp | |
parent | Add free extend builder with placeholder network support (diff) | |
download | ilt-38d7045685d4904d013ea4990a3aa7f5e78309cf.tar.bz2 ilt-38d7045685d4904d013ea4990a3aa7f5e78309cf.tar.xz ilt-38d7045685d4904d013ea4990a3aa7f5e78309cf.zip |
Add magic support to printing/parsing/validating enumerations
Diffstat (limited to 'lib/stream_support.hpp')
-rw-r--r-- | lib/stream_support.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/stream_support.hpp b/lib/stream_support.hpp index 5238234..2ab2f9d 100644 --- a/lib/stream_support.hpp +++ b/lib/stream_support.hpp @@ -1,5 +1,6 @@ #pragma once +#include "enumDetails.hpp" #include <glm/glm.hpp> #include <iostream> #include <maths.h> @@ -51,6 +52,16 @@ namespace std { { return s << arc.first << " ↺ " << arc.second; } + + template<typename E> + concept IsEnum = std::is_enum_v<E>; + + template<IsEnum E> + inline std::ostream & + operator<<(std::ostream & s, const E & e) + { + return s << EnumTypeDetails<E>::typeName << "::" << EnumDetails<E>::to_string(e).value(); + } } template<typename T> |