UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IsFixedWidthCharEncoding.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include <type_traits>
6#include "Traits/IsCharType.h"
7
8#ifndef PLATFORM_TCHAR_IS_CHAR16
9 #error "Traits/IsFixedWidthCharEncoding.h should be included after platform headers"
10#endif
11
12namespace UE::Core::Private
13{
17 template <typename Encoding>
18 constexpr bool IsFixedWidthEncodingImpl()
19 {
20 return
21 std::is_same_v<Encoding, ANSICHAR> ||
22 std::is_same_v<Encoding, UCS2CHAR> || // this may not be true when PLATFORM_UCS2CHAR_IS_UTF16CHAR == 1, but this is the legacy behavior
23 std::is_same_v<Encoding, WIDECHAR> || // the UCS2CHAR comment also applies to WIDECHAR
24#if PLATFORM_TCHAR_IS_CHAR16
25 std::is_same_v<Encoding, wchar_t> || // the UCS2CHAR comment also applies to wchar_t
26#endif
27 std::is_same_v<Encoding, UTF32CHAR>;
28 }
29}
30
31template <typename Encoding>
33{
34 static_assert(TIsCharType_V<Encoding>, "Encoding is not a character encoding type");
35
36 static constexpr bool Value = UE::Core::Private::IsFixedWidthEncodingImpl<std::remove_cv_t<Encoding>>();
37};
38
39template <typename Encoding>
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr bool TIsFixedWidthCharEncoding_V
Definition IsFixedWidthCharEncoding.h:40
implementation
Definition PlayInEditorLoadingScope.h:8
constexpr bool IsFixedWidthEncodingImpl()
Definition IsFixedWidthCharEncoding.h:18
Definition IsFixedWidthCharEncoding.h:33
static constexpr bool Value
Definition IsFixedWidthCharEncoding.h:36