UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Mismatch.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"
6#include "Templates/EqualTo.h"
7#include "Templates/IdentityFunctor.h"
8#include "Templates/Invoke.h"
10
11#include <type_traits>
12
13namespace Algo::Private
14{
15 template <typename InputAType, typename InputBType, typename ProjectionType, typename PredicateType>
17 {
18 using IndexType = std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>;
19
20 IndexType Index = 0;
21
22 const IndexType SizeA = (IndexType)GetNum(InputA);
23 const IndexType SizeB = (IndexType)GetNum(InputB);
24
25 auto* A = GetData(InputA);
26 auto* B = GetData(InputB);
27
28 for (;;)
29 {
30 if (Index == SizeA || Index == SizeB)
31 {
32 break;
33 }
34
35 if (!Invoke(Predicate, Invoke(Projection, *A++), Invoke(Projection, *B++)))
36 {
37 break;
38 }
39
40 ++Index;
41 }
42
43 return Index;
44 }
45}
46
47namespace Algo
48{
57 template <typename InputAType, typename InputBType>
58 [[nodiscard]] constexpr auto Mismatch(const InputAType& InputA, const InputBType& InputB) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
59 {
61 }
62
72 template <typename InputAType, typename InputBType, typename PredicateType>
73 [[nodiscard]] constexpr auto Mismatch(const InputAType& InputA, const InputBType& InputB, PredicateType Predicate) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
74 {
76 }
77
87 template <typename InputAType, typename InputBType, typename ProjectionType>
88 [[nodiscard]] constexpr auto MismatchBy(const InputAType& InputA, const InputBType& InputB, ProjectionType Projection) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
89 {
91 }
92
103 template <typename InputAType, typename InputBType, typename ProjectionType, typename PredicateType>
104 [[nodiscard]] constexpr auto MismatchBy(const InputAType& InputA, const InputBType& InputB, ProjectionType Projection, PredicateType Predicate) -> std::common_type_t<decltype(GetNum(InputA)), decltype(GetNum(InputB))>
105 {
107 }
108}
AUTORTFM_INFER UE_FORCEINLINE_HINT constexpr auto Invoke(FuncType &&Func, ArgTypes &&... Args) -> decltype(((FuncType &&) Func)((ArgTypes &&) Args...))
Definition Invoke.h:44
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
AUTORTFM_INFER constexpr auto Projection(Invocable0Type &&Invocable0, InvocableTypes &&... Invocables)
Definition Projection.h:108
auto GetNum(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Length())
Definition StringConv.h:808
auto GetData(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Get())
Definition StringConv.h:802
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition Compare.h:13
constexpr auto Mismatch(const InputAType &InputA, const InputBType &InputB, ProjectionType Projection, PredicateType Predicate)
Definition Mismatch.h:16
Definition ParallelSort.h:13
constexpr auto Mismatch(const InputAType &InputA, const InputBType &InputB) -> std::common_type_t< decltype(GetNum(InputA)), decltype(GetNum(InputB))>
Definition Mismatch.h:58
constexpr auto MismatchBy(const InputAType &InputA, const InputBType &InputB, ProjectionType Projection) -> std::common_type_t< decltype(GetNum(InputA)), decltype(GetNum(InputB))>
Definition Mismatch.h:88
U16 Index
Definition radfft.cpp:71
Definition IdentityFunctor.h:11
Definition EqualTo.h:18