diff --git a/Code/util/ct_string.h b/Code/util/ct_string.h index e0ebe5377..a49998df6 100644 --- a/Code/util/ct_string.h +++ b/Code/util/ct_string.h @@ -8,6 +8,7 @@ #include #include +#include #include namespace hemelb { @@ -33,6 +34,9 @@ namespace hemelb { constexpr std::string str() const { return {str_, N}; } + constexpr std::string_view view() const { + return {str_, N}; + } constexpr char const *c_str() const { return str_; @@ -45,12 +49,12 @@ namespace hemelb { template constexpr auto operator==(const ct_string& left, const ct_string& right) { - return left.str() == right.str(); + return left.view() == right.view(); } template constexpr auto operator==(const ct_string& left, const char* right) { - return left.str() == std::string{right}; + return left.view() == std::string_view{right}; } template constexpr auto operator==(const char* left, const ct_string right) {