From ea3871026ab8b44cafa64a4135e9b04a0dba144b Mon Sep 17 00:00:00 2001 From: neargye Date: Mon, 15 Aug 2022 12:38:17 +0400 Subject: [PATCH] fix IntelliSence --- include/nameof.hpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index 857b4fe..7c52d4d 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -186,11 +186,11 @@ constexpr string_view member_name() noexcept { } // namespace nameof::customize -template +template class [[nodiscard]] cstring { public: using value_type = const char; - using size_type = std::size_t; + using size_type = std::uint16_t; using difference_type = std::ptrdiff_t; using pointer = const char*; using const_pointer = const char*; @@ -203,7 +203,7 @@ class [[nodiscard]] cstring { using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; - constexpr explicit cstring(string_view str) noexcept : cstring{str, std::make_index_sequence{}} { + constexpr explicit cstring(string_view str) noexcept : cstring{str, std::make_integer_sequence{}} { assert(str.size() > 0 && str.size() == N); } @@ -262,17 +262,17 @@ class [[nodiscard]] cstring { [[nodiscard]] explicit operator string() const { return {begin(), end()}; } private: - template - constexpr cstring(string_view str, std::index_sequence) noexcept : chars_{str[I]..., '\0'} {} + template + constexpr cstring(string_view str, std::integer_sequence) noexcept : chars_{str[I]..., '\0'} {} - char chars_[N + 1]; + char chars_[static_cast(N) + 1]; }; template <> class [[nodiscard]] cstring<0> { public: using value_type = const char; - using size_type = std::size_t; + using size_type = std::uint16_t; using difference_type = std::ptrdiff_t; using pointer = const char*; using const_pointer = const char*; @@ -336,67 +336,67 @@ class [[nodiscard]] cstring<0> { [[nodiscard]] explicit operator string() const { return {}; } }; -template +template [[nodiscard]] constexpr bool operator==(const cstring& lhs, string_view rhs) noexcept { return lhs.compare(rhs) == 0; } -template +template [[nodiscard]] constexpr bool operator==(string_view lhs, const cstring& rhs) noexcept { return lhs.compare(rhs) == 0; } -template +template [[nodiscard]] constexpr bool operator!=(const cstring& lhs, string_view rhs) noexcept { return lhs.compare(rhs) != 0; } -template +template [[nodiscard]] constexpr bool operator!=(string_view lhs, const cstring& rhs) noexcept { return lhs.compare(rhs) != 0; } -template +template [[nodiscard]] constexpr bool operator>(const cstring& lhs, string_view rhs) noexcept { return lhs.compare(rhs) > 0; } -template +template [[nodiscard]] constexpr bool operator>(string_view lhs, const cstring& rhs) noexcept { return lhs.compare(rhs) > 0; } -template +template [[nodiscard]] constexpr bool operator>=(const cstring& lhs, string_view rhs) noexcept { return lhs.compare(rhs) >= 0; } -template +template [[nodiscard]] constexpr bool operator>=(string_view lhs, const cstring& rhs) noexcept { return lhs.compare(rhs) >= 0; } -template +template [[nodiscard]] constexpr bool operator<(const cstring& lhs, string_view rhs) noexcept { return lhs.compare(rhs) < 0; } -template +template [[nodiscard]] constexpr bool operator<(string_view lhs, const cstring& rhs) noexcept { return lhs.compare(rhs) < 0; } -template +template [[nodiscard]] constexpr bool operator<=(const cstring& lhs, string_view rhs) noexcept { return lhs.compare(rhs) <= 0; } -template +template [[nodiscard]] constexpr bool operator<=(string_view lhs, const cstring& rhs) noexcept { return lhs.compare(rhs) <= 0; } -template +template std::basic_ostream& operator<<(std::basic_ostream& os, const cstring& srt) { for (const auto c : srt) { os.put(c);