UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Contains.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Algo/Find.h"
6#include "Templates/UnrealTemplate.h" // For MoveTemp and Forward
7
8namespace Algo
9{
18 template <typename RangeType, typename ValueType>
19 [[nodiscard]] UE_REWRITE constexpr bool Contains(RangeType&& Range, const ValueType& Value)
20 {
21 return !!Algo::Find(Forward<RangeType>(Range), Value);
22 }
23
33 template <typename RangeType, typename ValueType, typename ProjectionType>
34 [[nodiscard]] UE_REWRITE constexpr bool ContainsBy(RangeType&& Range, const ValueType& Value, ProjectionType Proj)
35 {
37 }
38
39 // There is no Algo::ContainsByPredicate as it would be identical to Algo::AnyOf.
40 // This comment exists to guide users to Algo::AnyOf.
41}
#define UE_REWRITE
Definition Platform.h:747
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition ParallelSort.h:13
UE_REWRITE constexpr bool ContainsBy(RangeType &&Range, const ValueType &Value, ProjectionType Proj)
Definition Contains.h:34
UE_REWRITE constexpr auto Find(RangeType &&Range, const ValueType &Value) -> decltype(AlgoImpl::FindBy(Forward< RangeType >(Range), Value, FIdentityFunctor()))
Definition Find.h:52
UE_REWRITE constexpr auto FindBy(RangeType &&Range, const ValueType &Value, ProjectionType Proj) -> decltype(AlgoImpl::FindBy(Forward< RangeType >(Range), Value, MoveTemp(Proj)))
Definition Find.h:68
UE_REWRITE constexpr bool Contains(RangeType &&Range, const ValueType &Value)
Definition Contains.h:19