PCL
Search Algorithms

## Functions

template<class FI , class T >
FI pcl::BinarySearch (FI i, FI j, const T &v)

template<class FI , class T , class BP >
FI pcl::BinarySearch (FI i, FI j, const T &v, BP p)

template<class FI , class T , class BP1 , class BP2 >
FI pcl::BinarySearch (FI i, FI j, const T &v, BP1 p1, BP2 p2)

template<class FI , class T >
FI pcl::BinarySearchLast (FI i, FI j, const T &v)

template<class FI , class T , class BP >
FI pcl::BinarySearchLast (FI i, FI j, const T &v, BP p)

template<class FI , class T >
FI pcl::InsertionPoint (FI i, FI j, const T &v)

template<class FI , class T , class BP >
FI pcl::InsertionPoint (FI i, FI j, const T &v, BP p)

template<class FI , class T >
FI pcl::LinearSearch (FI i, FI j, const T &v)

template<class FI , class T , class BP >
FI pcl::LinearSearch (FI i, FI j, const T &v, BP p)

template<class BI , class T >
BI pcl::LinearSearchLast (BI i, BI j, const T &v)

template<class BI , class T , class BP >
BI pcl::LinearSearchLast (BI i, BI j, const T &v, BP p)

template<class FI1 , class FI2 >
FI1 pcl::Search (FI1 i1, FI1 j1, FI2 i2, FI2 j2)

template<class FI1 , class FI2 , class BP >
FI1 pcl::Search (FI1 i1, FI1 j1, FI2 i2, FI2 j2, BP p)

template<class BI1 , class FI2 >
BI1 pcl::SearchLast (BI1 i1, BI1 j1, FI2 i2, FI2 j2)

template<class BI1 , class FI2 , class BP >
BI1 pcl::SearchLast (BI1 i1, BI1 j1, FI2 i2, FI2 j2, BP p)

## Detailed Description

Template formal parameters:

FI Forward iterator
BI Bidirectional iterator
RI Random access iterator
UP Unary predicate
BP Binary predicate
T Item type
F Function

## ◆ BinarySearch() [1/3]

template<class FI , class T >
 FI pcl::BinarySearch ( FI i, FI j, const T & v )
inline

Generic binary search algorithm.

Returns the first iterator k in the range [i,j) such that *k == v. Returns j if no such occurrence of v is found.

The sequence [i,j) must be ordered in ascending order: for every pair a,b in [i,j) such that i precedes j, *j < *i must be false.

Definition at line 170 of file Search.h.

## ◆ BinarySearch() [2/3]

template<class FI , class T , class BP >
 FI pcl::BinarySearch ( FI i, FI j, const T & v, BP p )
inline

Generic binary search algorithm.

Returns the first iterator k in the range [i,j) such that both p( *k, v ) and p( v, *k ) are false. Returns j if no such occurrence of v is found.

The sequence [i,j) must be ordered in ascending order: for every pair a,b in [i,j) such that i precedes j, p( *j, *i ) must be false.

Definition at line 204 of file Search.h.

## ◆ BinarySearch() [3/3]

template<class FI , class T , class BP1 , class BP2 >
 FI pcl::BinarySearch ( FI i, FI j, const T & v, BP1 p1, BP2 p2 )
inline

Generic binary search algorithm.

Returns the first iterator k in the range [i,j) such that both p1( *k, v ) and p2( v, *k ) are false. Returns j if no such occurrence of v is found.

The sequence [i,j) must be ordered in ascending order: for every pair a,b in [i,j) such that i precedes j, both p1( *j, *i ) and p2( *j, *i ) must be false.

Definition at line 285 of file Search.h.

## ◆ BinarySearchLast() [1/2]

template<class FI , class T >
 FI pcl::BinarySearchLast ( FI i, FI j, const T & v )
inline

Generic binary search algorithm (last occurrence).

Returns the last iterator k in the range [i,j) such that *k == v. Returns j if no such occurrence of v is found.

The sequence [i,j) must be ordered in ascending order: for every pair a,b in [i,j) such that i precedes j, *j < *i must be false.

Definition at line 238 of file Search.h.

## ◆ BinarySearchLast() [2/2]

template<class FI , class T , class BP >
 FI pcl::BinarySearchLast ( FI i, FI j, const T & v, BP p )
inline

Generic binary search algorithm (last occurrence).

Returns the last iterator k in the range [i,j) such that both p( *k, v ) and p( v, *k ) are false. Returns j if no such occurrence of v is found.

The sequence [i,j) must be ordered in ascending order: for every pair a,b in [i,j) such that i precedes j, p( *j, *i ) must be false.

Definition at line 261 of file Search.h.

## ◆ InsertionPoint() [1/2]

template<class FI , class T >
 FI pcl::InsertionPoint ( FI i, FI j, const T & v )
inline

Generic insertion point algorithm.

Returns an iterator k in the range [i,j) such that:

• for all a in [i,j) that precedes k, v < *a is false.
• for all b in [i,j) that postcedes k, *b < v is false.

The sequence [i,j) must be ordered in ascending order: for every pair a,b in [i,j) such that i precedes j, *j < *i must be false.

The resulting iterator k corresponds to a location where the value v could be inserted in the [i,j) sequence without breaking the existing order of values, as defined by operator <.

Definition at line 326 of file Search.h.

## ◆ InsertionPoint() [2/2]

template<class FI , class T , class BP >
 FI pcl::InsertionPoint ( FI i, FI j, const T & v, BP p )
inline

Generic insertion point algorithm.

Returns an iterator k in the range [i,j) such that:

• for all a in [i,j) that precedes k, p( v, *a ) is false.
• for all b in [i,j) that postcedes k, p( *b, v ) is false.

The sequence [i,j) must be ordered in ascending order: for every pair a,b in [i,j) such that i precedes j, p( *j, *i ) must be false.

The resulting iterator k corresponds to a location where the value v could be inserted in the [i,j) sequence without breaking the existing order of values, as defined by the binary predicate p.

Definition at line 367 of file Search.h.

## ◆ LinearSearch() [1/2]

template<class FI , class T >
 FI pcl::LinearSearch ( FI i, FI j, const T & v )
inline

Generic linear search algorithm.

Returns the first iterator k in the range [i,j) such that *k == v. Returns j if no such occurrence of v is found.

Definition at line 91 of file Search.h.

## ◆ LinearSearch() [2/2]

template<class FI , class T , class BP >
 FI pcl::LinearSearch ( FI i, FI j, const T & v, BP p )
inline

Generic linear search algorithm.

Returns the first iterator k in the range [i,j) such that p( *k, v ) is true. Returns j if no such occurrence of v is found.

Definition at line 110 of file Search.h.

## ◆ LinearSearchLast() [1/2]

template<class BI , class T >
 BI pcl::LinearSearchLast ( BI i, BI j, const T & v )
inline

Generic linear search algorithm (last occurrence).

Returns the last iterator k in the range [i,j) such that *k == v. Returns j if no such occurrence of v is found.

Definition at line 129 of file Search.h.

## ◆ LinearSearchLast() [2/2]

template<class BI , class T , class BP >
 BI pcl::LinearSearchLast ( BI i, BI j, const T & v, BP p )
inline

Generic linear search algorithm (last occurrence).

Returns the last iterator k in the range [i,j) such that *k == v. Returns j if no such occurrence of v is found.

Definition at line 148 of file Search.h.

## ◆ Search() [1/2]

template<class FI1 , class FI2 >
 FI1 pcl::Search ( FI1 i1, FI1 j1, FI2 i2, FI2 j2 )
inline

Returns the starting iterator of the first subsequence within the range [i1,j1) that is identical to the sequence [i2,j2) when compared element by element, or j1 if no such subsequence is found.

Definition at line 397 of file Search.h.

References pcl::Distance().

## ◆ Search() [2/2]

template<class FI1 , class FI2 , class BP >
 FI1 pcl::Search ( FI1 i1, FI1 j1, FI2 i2, FI2 j2, BP p )
inline

Returns the starting iterator of the first subsequence within the range [i1,j1) that corresponds to the sequence [i2,j2) when the binary predicate p is applied element by element, or j1 if no such subsequence is found.

Definition at line 423 of file Search.h.

References pcl::Distance().

## ◆ SearchLast() [1/2]

template<class BI1 , class FI2 >
 BI1 pcl::SearchLast ( BI1 i1, BI1 j1, FI2 i2, FI2 j2 )
inline

Returns the starting iterator of the last subsequence within the range [i1,j1) that is identical to the sequence [i2,j2) when compared element by element, or j1 if no such subsequence is found.

Definition at line 449 of file Search.h.

References pcl::Distance().

## ◆ SearchLast() [2/2]

template<class BI1 , class FI2 , class BP >
 BI1 pcl::SearchLast ( BI1 i1, BI1 j1, FI2 i2, FI2 j2, BP p )
inline

Returns the starting iterator of the last subsequence within the range [i1,j1) that corresponds to the sequence [i2,j2) when the binary predicate p is applied element by element, or j1 if no such subsequence is found.

Definition at line 481 of file Search.h.

References pcl::Distance().