UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IsContiguousContainer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
7#include <initializer_list>
8
14template <typename T>
16{
17 UE_STATIC_ASSERT_COMPLETE_TYPE(T, "TIsContiguousContainer instantiated with an incomplete type");
18 // This sizeof(T) == 0 test will let Clang treat zero-sized arrays as contiguous containers.
19 // An alternate fix using a specialization of TIsContiguousContainer (which Clang doesn't support) can be found below.
20 static constexpr bool Value = sizeof(T) == 0;
21};
22
23template <typename T> struct TIsContiguousContainer< T& > : TIsContiguousContainer<T> {};
24template <typename T> struct TIsContiguousContainer< T&&> : TIsContiguousContainer<T> {};
25template <typename T> struct TIsContiguousContainer<const T> : TIsContiguousContainer<T> {};
26template <typename T> struct TIsContiguousContainer< volatile T> : TIsContiguousContainer<T> {};
27template <typename T> struct TIsContiguousContainer<const volatile T> : TIsContiguousContainer<T> {};
28
32template <typename T, size_t N> struct TIsContiguousContainer< T[N]> { static constexpr bool Value = true; };
33template <typename T, size_t N> struct TIsContiguousContainer<const T[N]> { static constexpr bool Value = true; };
34template <typename T, size_t N> struct TIsContiguousContainer< volatile T[N]> { static constexpr bool Value = true; };
35template <typename T, size_t N> struct TIsContiguousContainer<const volatile T[N]> { static constexpr bool Value = true; };
36
40#ifndef __clang__
41 template <typename T> struct TIsContiguousContainer< T[0]> { static constexpr bool Value = true; };
42 template <typename T> struct TIsContiguousContainer<const T[0]> { static constexpr bool Value = true; };
43 template <typename T> struct TIsContiguousContainer< volatile T[0]> { static constexpr bool Value = true; };
44 template <typename T> struct TIsContiguousContainer<const volatile T[0]> { static constexpr bool Value = true; };
45#endif
46
50template <typename T> struct TIsContiguousContainer< T[]> { static constexpr bool Value = false; };
51template <typename T> struct TIsContiguousContainer<const T[]> { static constexpr bool Value = false; };
52template <typename T> struct TIsContiguousContainer< volatile T[]> { static constexpr bool Value = false; };
53template <typename T> struct TIsContiguousContainer<const volatile T[]> { static constexpr bool Value = false; };
54
58template <typename T>
60{
61 static constexpr bool Value = true;
62};
63
64template <typename T>
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr bool TIsContiguousContainer_V
Definition IsContiguousContainer.h:65
Definition IsContiguousContainer.h:16
UE_STATIC_ASSERT_COMPLETE_TYPE(T, "TIsContiguousContainer instantiated with an incomplete type")
static constexpr bool Value
Definition IsContiguousContainer.h:20