diff options
Diffstat (limited to 'lib/helpers.h')
-rw-r--r-- | lib/helpers.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/helpers.h b/lib/helpers.h index 3a94ead..a8a630e 100644 --- a/lib/helpers.h +++ b/lib/helpers.h @@ -3,6 +3,7 @@ #include <concepts> #include <cstdint> +#include <string> #include <utility> namespace MyGrate { @@ -30,6 +31,24 @@ namespace MyGrate { i /= 100; return r; } + + template<typename T> + concept Stringable = requires(T a) + { + { + std::to_string(a) + } -> std::same_as<std::string>; + }; + template<typename T> + concept Viewable = requires(T a) + { + { + a.data() + } -> std::convertible_to<const char *>; + { + a.size() + } -> std::integral; + }; } #endif |