System.Generics.Collections.TArray.LastIndexOf
Delphi
class function LastIndexOf<T>(const Values: array of T; const Item: T): NativeInt; overload; static;
class function LastIndexOf<T>(const Values: array of T; const Item: T;
Index: NativeInt): NativeInt; overload; static;
class function LastIndexOf<T>(const Values: array of T; const Item: T;
const Comparer: IComparer<T>; Index, Count: NativeInt): NativeInt; overload; static;
C++
template<typename T> static System::NativeInt __fastcall LastIndexOf(const T *Values, const System::NativeInt Values_High, const T Item)/* overload */;
template<typename T> static System::NativeInt __fastcall LastIndexOf(const T *Values, const System::NativeInt Values_High, const T Item, System::NativeInt Index)/* overload */;
template<typename T> static System::NativeInt __fastcall LastIndexOf(const T *Values, const System::NativeInt Values_High, const T Item, const System::DelphiInterface<System::Generics::Defaults::IComparer__1<T> > Comparer, System::NativeInt Index, System::NativeInt Count)/* overload */;
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.Generics.Collections.pas System.Generics.Collections.hpp |
System.Generics.Collections | TArray |
説明
配列内にある Value
の最後のインスタンスに対する 0 から始まるインデックスを取得します。 要素が見つからない場合は、-1
を返します。
要素の検索はリニアなので、これは、n エントリを持つ配列に対する O(n) 操作になります。