diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-07-20 17:02:05 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-07-20 17:02:05 +0200 |
commit | fac9e8bec1983fa9dff8f447fef106e427dfec26 (patch) | |
tree | 2221d4216873fa8250dd5ff45f00d0d6b46eab26 /src/core/string_literal.h | |
parent | 398164432abcf599eaa51ebc4088024b7f46b97f (diff) |
c++: Renamed src to c++
Diffstat (limited to 'src/core/string_literal.h')
-rw-r--r-- | src/core/string_literal.h | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/core/string_literal.h b/src/core/string_literal.h deleted file mode 100644 index d530a54..0000000 --- a/src/core/string_literal.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include <array> -#include <string_view> - -namespace saw { -/** - * Helper object which creates a templated string from the provided string - * literal. It guarantees compile time uniqueness and thus allows using strings - * in template parameters. - */ -template <class CharT, size_t N> class string_literal { -public: - constexpr string_literal(const CharT (&input)[N]) noexcept { - for (size_t i = 0; i < N; ++i) { - data[i] = input[i]; - } - } - - std::array<CharT, N> data{}; - - constexpr std::string_view view() const noexcept { - return std::string_view{data.data()}; - } - - constexpr bool - operator==(const string_literal<CharT, N> &) const noexcept = default; - - template <class CharTR, size_t NR> - constexpr bool - operator==(const string_literal<CharTR, NR> &) const noexcept { - return false; - } -}; - -template <typename T, T... Chars> -constexpr string_literal<T, sizeof...(Chars)> operator""_key() { - return string_literal<T, sizeof...(Chars) + 1u>{Chars..., '\0'}; -} -} // namespace saw |