algorithms/ findfirstof.bi

Summary
algorithms/ findfirstof.bi
LicenseCopyright © 2009, FreeBASIC Extended Library Development Group
Functions
FindFirstOfFinds the first occurance of an element in the range [//first1//, //last1//) equal to any one of the elements in the range [//first2//, //last2//).
FindFirstOfFinds the first occurance of an element in the range [//first1//, //last1//) that satisfies a predicate //pred// with any one of the elements in the range [//first2//, //last2//).

License

Copyright © 2009, FreeBASIC Extended Library Development Group

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com- /p- /fb-extended-lib- /wiki- /License

Functions

FindFirstOf

declare function FindFirstOf overload (
   byval first1 as fbext_TypeName(T_) ptr,
   byval last1 as fbext_TypeName(T_) ptr,
   byval first2 as fbext_TypeName(T_) ptr,
   byval last2 as fbext_TypeName(T_) ptr
) as fbext_TypeName(T_) ptr

Finds the first occurance of an element in the range [//first1//, //last1//) equal to any one of the elements in the range [//first2//, //last2//).

Parameters

first1A pointer to the first element in the range to search.
last1A pointer to one-past the last element in the range to search.
first2A pointer to the first elements in the range to search for.
last2A pointer to one-past the last element in the range to search for.

Returns

Returns a pointer to the element, or //last1// if no such element is found.

FindFirstOf

declare function FindFirstOf overload (
   byval first1 as fbext_TypeName(T_) ptr,
   byval last1 as fbext_TypeName(T_) ptr,
   byval first2 as fbext_TypeName(T_) ptr,
   byval last2 as fbext_TypeName(T_) ptr,
   byval pred as function ( byref as const fbext_TypeName(T_), byref as const fbext_TypeName(T_) ) as bool
) as fbext_TypeName(T_) ptr

Finds the first occurance of an element in the range [//first1//, //last1//) that satisfies a predicate //pred// with any one of the elements in the range [//first2//, //last2//).

Parameters

first1A pointer to the first element in the range to search.
last1A pointer to one-past the last element in the range to search.
first2A pointer to the first elements in the range to search for.
last2A pointer to one-past the last element in the range to search for.
predThe predicate to test elements with.

Returns

Returns a pointer to the element, or //last1// if no such element is found.

declare function FindFirstOf overload (
   byval first1 as fbext_TypeName(T_) ptr,
   byval last1 as fbext_TypeName(T_) ptr,
   byval first2 as fbext_TypeName(T_) ptr,
   byval last2 as fbext_TypeName(T_) ptr
) as fbext_TypeName(T_) ptr
Finds the first occurance of an element in the range [//first1//, //last1//) equal to any one of the elements in the range [//first2//, //last2//).