summaryrefslogtreecommitdiffhomepage
path: root/include/unicode
diff options
context:
space:
mode:
Diffstat (limited to 'include/unicode')
-rw-r--r--include/unicode/type_traits.h6
-rw-r--r--include/unicode/utf.h5
-rw-r--r--include/unicode/utf_fwd.h7
3 files changed, 10 insertions, 8 deletions
diff --git a/include/unicode/type_traits.h b/include/unicode/type_traits.h
index c3507e7..63c7d69 100644
--- a/include/unicode/type_traits.h
+++ b/include/unicode/type_traits.h
@@ -50,7 +50,7 @@ namespace unicode {
template<typename T>
struct is_utf_8
{
- static const bool value{std::is_trivial_v<T> && sizeof(T) == 1};
+ static const bool value{std::is_same_v<T, UTF_8> || (std::is_trivial_v<T> && sizeof(T) == 1)};
};
template<typename T>
@@ -59,7 +59,7 @@ namespace unicode {
template<typename T>
struct is_utf_16
{
- static const bool value{std::is_trivial_v<T> && sizeof(T) == 2};
+ static const bool value{std::is_same_v<T, UTF_16> || (std::is_trivial_v<T> && sizeof(T) == 2)};
};
template<typename T>
@@ -68,7 +68,7 @@ namespace unicode {
template<typename T>
struct is_utf_32
{
- static const bool value{std::is_trivial_v<T> && sizeof(T) == 4};
+ static const bool value{std::is_same_v<T, UTF_32> || (std::is_trivial_v<T> && sizeof(T) == 4)};
};
template<typename T>
diff --git a/include/unicode/utf.h b/include/unicode/utf.h
index 81e8f2b..046d9c6 100644
--- a/include/unicode/utf.h
+++ b/include/unicode/utf.h
@@ -415,11 +415,6 @@ namespace unicode {
}
};
- // Encoding for convert()
- typedef UTF<utf_iterator<utf8_t>, utf_back_insert_iterator<utf8_t>> UTF_8;
- typedef UTF<utf_iterator<char16_t>, utf_back_insert_iterator<char16_t>> UTF_16;
- typedef UTF<utf_iterator<char32_t>, utf_back_insert_iterator<char32_t>> UTF_32;
-
// Helper to get correct Encoding from char type, e.g. Encoding<typename decltype(s)::value_type>::type or Encoding_t<typename decltype(s)::value_type>
template<typename T>
struct Encoding
diff --git a/include/unicode/utf_fwd.h b/include/unicode/utf_fwd.h
index f3f6c52..c42dea1 100644
--- a/include/unicode/utf_fwd.h
+++ b/include/unicode/utf_fwd.h
@@ -2,6 +2,8 @@
// Forward declarations
+#include "types.h"
+
#include <string>
namespace unicode::detail {
@@ -19,5 +21,10 @@ namespace unicode {
template<typename InputIt, typename OutputIt>
struct UTF;
+ // Encoding for convert()
+ typedef UTF<utf_iterator<utf8_t>, utf_back_insert_iterator<utf8_t>> UTF_8;
+ typedef UTF<utf_iterator<char16_t>, utf_back_insert_iterator<char16_t>> UTF_16;
+ typedef UTF<utf_iterator<char32_t>, utf_back_insert_iterator<char32_t>> UTF_32;
+
} // namespace unicode