STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
Classes | Modules | Functions
Non-modifying Sequence Operations

Search and query view elements. More...

+ Collaboration diagram for Non-modifying Sequence Operations:

Classes

class  stapl::algo_details::range_all_of< Predicate >
 Work function invokes sequential (i.e., STL) all_of. More...
 
class  stapl::algo_details::range_none_of< Predicate >
 Work function invokes sequential (i.e., STL) none_of. More...
 
class  stapl::algo_details::range_any_of< Predicate >
 Work function invokes sequential (i.e., STL) any_of. More...
 
class  stapl::algo_details::range_count_if< Predicate >
 Work function invokes sequential (i.e., STL) count_if. More...
 
class  stapl::algo_details::range_equal< Predicate >
 Work function invokes sequential (i.e., STL) equal. More...
 
class  stapl::algo_details::range_mismatch< Predicate >
 Work function invokes sequential (i.e., STL) mismatch. More...
 
class  stapl::algo_details::range_find< Predicate >
 Work function invokes sequential (i.e., STL) find. More...
 
class  stapl::algo_details::range_adjacent_find< Predicate >
 Work function invokes sequential (i.e., STL) adjacent_find. More...
 
class  stapl::algo_details::range_find_end< Predicate >
 Work function invokes sequential (i.e., STL) find_end. More...
 
struct  stapl::algo_details::find_end_reduce
 Work function which returns its second argument if non-null, and the first otherwise. More...
 
class  stapl::algo_details::range_find_first_of< Predicate >
 Work function invokes sequential (i.e., STL) find_first_of. More...
 
class  stapl::algo_details::range_search< Predicate >
 Work function invokes sequential (i.e., STL) search. More...
 
class  stapl::algo_details::range_search_n< T, Predicate >
 Work function invokes sequential (i.e., STL) search_n. Returns information about matches found in the range as well as partial matches found at the front and back of the range. More...
 

Modules

 Search Operations
 Search for elements in view(s) that meet the specified criteria (e.g. stapl::find()). Defined in stapl/algorithms/algorithm.hpp.
 
 Summary Operations
 Summarize the entire set of elements in the view(s) (e.g., stapl::equal()).
 
 Extrema Operations
 Find the extreme values in the view provided (e.g., stapl::min_element()). Defined in stapl/algorithms/algorithm.hpp.
 
 Counting Operations
 Summarize the number of elements in the view(s) that meet the specified criteria. Defined in stapl/algorithms/algorithm.hpp.
 

Functions

template<typename View0 , typename Predicate >
bool stapl::all_of (View0 const &view, Predicate predicate)
 Returns true if the given predicate returns true for all of the elements in the input view. More...
 
template<typename View0 , typename Predicate >
bool stapl::none_of (View0 const &view, Predicate predicate)
 Returns true if the given predicate returns false for all of the elements in the input view, or the view is empty. More...
 
template<typename View0 , typename Predicate >
bool stapl::any_of (View0 const &view, Predicate predicate)
 Returns true if the given predicate returns true for any of the elements in the input view. More...
 
template<typename View , typename Predicate >
View::size_type stapl::count_if (View const &view, Predicate predicate)
 Computes the number of elements in the input view for which the given functor returns true. More...
 
template<typename View , typename T >
View::size_type stapl::count (View const &view, T const &value)
 Computes the number of elements in the input view which compare equal to the given value. More...
 
template<typename View1 , typename View2 , typename Predicate >
std::pair< typename View1::reference, typename View2::reference > stapl::mismatch (View1 const &view1, View2 const &view2, Predicate predicate)
 Given two input views, returns the positions of the first elements which do not match. More...
 
template<typename View1 , typename View2 >
std::pair< typename View1::reference, typename View2::reference > stapl::mismatch (View1 const &view1, View2 const &view2)
 Given two input views, returns the positions of the first elements which do not match. More...
 
template<typename View , typename Predicate >
View::reference stapl::find_if (View const &view, Predicate predicate)
 Finds the first element in the input for which the predicate returns true, or null_reference if none exist. More...
 
template<typename View , typename Predicate >
View::reference stapl::find_if_not (View const &view, Predicate predicate)
 Finds the first element in the input for which the predicate returns false, or null_reference if none exist. More...
 
template<typename View , typename T >
View::reference stapl::find (View const &view, T const &value)
 Finds the first occurrence of the given value in the input, null_reference if it is not found. More...
 
template<typename View , typename Predicate >
View::reference stapl::adjacent_find (View const &view, Predicate predicate)
 Return the position of the first adjacent pair of equal elements. More...
 
template<typename View >
View::reference stapl::adjacent_find (View const &view)
 Return the position of the first adjacent pair of equal elements. More...
 
template<typename View1 , typename View2 , typename Predicate >
View1::reference stapl::find_end (View1 const &sequence, View2 const &pattern, Predicate predicate)
 Finds the last occurrence of the given pattern in the input sequence. More...
 
template<typename View1 , typename View2 >
View1::reference stapl::find_end (View1 const &sequence, View2 const &pattern)
 Finds the last occurrence of the given pattern in the input sequence. More...
 
template<typename View0 , typename View1 , typename Predicate >
View0::reference stapl::find_first_of (View0 const &view0, View1 const &view1, Predicate predicate)
 Finds the first element in the input which matches any of the elements in the given view, according to the given predicate. More...
 
template<typename View0 , typename View1 >
View0::reference stapl::find_first_of (View0 const &view0, View1 const &view1)
 Finds the first element in the input which matches any of the elements in the given view. More...
 
template<typename View1 , typename View2 , typename Predicate >
View1::reference stapl::search (View1 const &v1, View2 const &v2, Predicate predicate)
 Return the position of the first occurrence of the given search sequence within the input, or a null_reference instance if it is not found. More...
 
template<typename View1 , typename View2 >
View1::reference stapl::search (View1 const &v1, View2 const &v2)
 Return the position of the first occurrence of the given sequence within the input, or a null_reference instance if the sequence is not found. More...
 
template<typename View , typename Predicate >
View::reference stapl::search_n (View const &v, size_t count, typename View::value_type value, Predicate predicate)
 Return the position of the first occurrence of a sequence of the given value which is of the given length, or a null_reference instance if it is not found. More...
 
template<typename View1 >
View1::reference stapl::search_n (View1 const &v1, size_t count, typename View1::value_type value)
 Return the position of the first occurrence of a sequence of the given value which is of the given length, or null_reference if none exists. More...
 
template<typename View0 , typename View1 , typename Predicate >
bool stapl::equal (View0 const &view0, View1 const &view1, Predicate predicate)
 Compares the two input views and returns true if all of their elements compare pairwise equal. More...
 

Detailed Description

Search and query view elements.

The non-modifying sequence operations do not directly modify the sequences of data they operate on. Each algorithm has two versions, one using operator== for comparisons, and the other using a user-defined function object.

Function Documentation

◆ all_of()

template<typename View0 , typename Predicate >
bool stapl::all_of ( View0 const &  view,
Predicate  predicate 
)

Returns true if the given predicate returns true for all of the elements in the input view.

Parameters
viewOne-dimensional view of the input.
predicateUnary functor which is called on the input elements.
Returns
True if the functor returns true for all elements, false otherwise.

◆ none_of()

template<typename View0 , typename Predicate >
bool stapl::none_of ( View0 const &  view,
Predicate  predicate 
)

Returns true if the given predicate returns false for all of the elements in the input view, or the view is empty.

Parameters
viewOne-dimensional view of the input.
predicateUnary functor which is called on the input elements.
Returns
True if the functor returns false for all elements, false otherwise.

◆ any_of()

template<typename View0 , typename Predicate >
bool stapl::any_of ( View0 const &  view,
Predicate  predicate 
)

Returns true if the given predicate returns true for any of the elements in the input view.

Parameters
viewOne-dimensional view of the input.
predicateUnary functor which is called on the input elements.
Returns
True if the functor returns true for any element, false otherwise.

◆ count_if()

template<typename View , typename Predicate >
View::size_type stapl::count_if ( View const &  view,
Predicate  predicate 
)

Computes the number of elements in the input view for which the given functor returns true.

Parameters
viewOne-dimensional view over the input elements.
predicateFunctor which is used to test the elements for counting.
Returns
The number of elements for which the functor returns true.

◆ count()

template<typename View , typename T >
View::size_type stapl::count ( View const &  view,
T const &  value 
)

Computes the number of elements in the input view which compare equal to the given value.

Parameters
viewOne-dimensional view over the input elements.
valueValue to count the occurrences of in the input.
Returns
The number of occurrences of the given element in the input.

◆ mismatch() [1/2]

template<typename View1 , typename View2 , typename Predicate >
std::pair<typename View1::reference, typename View2::reference> stapl::mismatch ( View1 const &  view1,
View2 const &  view2,
Predicate  predicate 
)

Given two input views, returns the positions of the first elements which do not match.

Parameters
view1One-dimensional view of input.
view2One-dimensional view of input.
predicateFunctor that evaluates whether elements match.
Returns
A pair containing references to the first mismatched element in each input view, or a pair of null_reference instances if the views are equal.

◆ mismatch() [2/2]

template<typename View1 , typename View2 >
std::pair<typename View1::reference, typename View2::reference> stapl::mismatch ( View1 const &  view1,
View2 const &  view2 
)

Given two input views, returns the positions of the first elements which do not match.

Parameters
view1One-dimensional view of input.
view2One-dimensional view of input.
Returns
A pair containing references to the first mismatched element in each input view, or a pair of null_reference instances if the views are equal.

◆ find_if()

template<typename View , typename Predicate >
View::reference stapl::find_if ( View const &  view,
Predicate  predicate 
)

Finds the first element in the input for which the predicate returns true, or null_reference if none exist.

Parameters
viewOne-dimensional view of the input.
predicateFunctor used to test the elements.
Returns
A reference to the first element found, or a null_reference if none found.

◆ find_if_not()

template<typename View , typename Predicate >
View::reference stapl::find_if_not ( View const &  view,
Predicate  predicate 
)

Finds the first element in the input for which the predicate returns false, or null_reference if none exist.

Parameters
viewOne-dimensional view of the input.
predicateFunctor used to test the elements.
Returns
A reference to the first element found, or a null_reference if none found.

◆ find()

template<typename View , typename T >
View::reference stapl::find ( View const &  view,
T const &  value 
)

Finds the first occurrence of the given value in the input, null_reference if it is not found.

Parameters
viewOne-dimensional view of the input.
valueValue to find.
Returns
A reference to the first element found, or a null_reference if none found.

◆ adjacent_find() [1/2]

template<typename View , typename Predicate >
View::reference stapl::adjacent_find ( View const &  view,
Predicate  predicate 
)

Return the position of the first adjacent pair of equal elements.

Parameters
viewOne-dimensional view of the input elements.
predicatePredicate functor which implements the equal operation.
Returns
A reference to the first element of the pair, or a null_reference if none exist.

◆ adjacent_find() [2/2]

template<typename View >
View::reference stapl::adjacent_find ( View const &  view)

Return the position of the first adjacent pair of equal elements.

Parameters
viewOne-dimensional view of the input elements.
Returns
A reference to the first element of the pair, or a null_reference if none exist.

◆ find_end() [1/2]

template<typename View1 , typename View2 , typename Predicate >
View1::reference stapl::find_end ( View1 const &  sequence,
View2 const &  pattern,
Predicate  predicate 
)

Finds the last occurrence of the given pattern in the input sequence.

Parameters
sequenceA one-dimensional view of the input.
patternThe pattern to search for in the input.
predicateFunctor which implements the equal operation.
Returns
A reference to the first element of the last occurrence of the pattern in the input, or a null_reference if the pattern is not found.

◆ find_end() [2/2]

template<typename View1 , typename View2 >
View1::reference stapl::find_end ( View1 const &  sequence,
View2 const &  pattern 
)

Finds the last occurrence of the given pattern in the input sequence.

Parameters
sequenceA one-dimensional view of the input.
patternThe pattern to search for in the input.
Returns
A reference to the first element of the last occurrence of the pattern in the input, or a null_reference if the pattern is not found.

◆ find_first_of() [1/2]

template<typename View0 , typename View1 , typename Predicate >
View0::reference stapl::find_first_of ( View0 const &  view0,
View1 const &  view1,
Predicate  predicate 
)

Finds the first element in the input which matches any of the elements in the given view, according to the given predicate.

Parameters
view0One-dimensional view of the input.
view1One-dimensional view of the elements to find.
predicateBinary functor which implements the less operation.
Returns
A reference to the first element that matches, or a null_reference otherwise.

◆ find_first_of() [2/2]

template<typename View0 , typename View1 >
View0::reference stapl::find_first_of ( View0 const &  view0,
View1 const &  view1 
)

Finds the first element in the input which matches any of the elements in the given view.

Parameters
view0One-dimensional view of the input.
view1One-dimensional view of the elements to find.
Returns
A reference to the first element that matches, or a null_reference otherwise.

◆ search() [1/2]

template<typename View1 , typename View2 , typename Predicate >
View1::reference stapl::search ( View1 const &  v1,
View2 const &  v2,
Predicate  predicate 
)

Return the position of the first occurrence of the given search sequence within the input, or a null_reference instance if it is not found.

Parameters
v1One-dimensional view of the input elements.
v2One-dimensional view of the search sequence.
predicateFunctor that evaluates whether elements are equal.
Returns
A reference to the first element of the pair, or null_reference if none exist.

◆ search() [2/2]

template<typename View1 , typename View2 >
View1::reference stapl::search ( View1 const &  v1,
View2 const &  v2 
)

Return the position of the first occurrence of the given sequence within the input, or a null_reference instance if the sequence is not found.

Parameters
v1One-dimensional view of the input elements.
v2One-dimensional view of the search sequence.
Returns
A reference to the first element of the pair, or null_reference if none exist.

◆ search_n() [1/2]

template<typename View , typename Predicate >
View::reference stapl::search_n ( View const &  v,
size_t  count,
typename View::value_type  value,
Predicate  predicate 
)

Return the position of the first occurrence of a sequence of the given value which is of the given length, or a null_reference instance if it is not found.

Parameters
vOne-dimensional view of input elements.
countLength of sequence of repeated elements to find.
valueValue which is repeated in the searched sequence.
predicateFunctor which implements the equality operation.
Returns
A reference to the first element of the repeated sequence in the input, or a null_reference instance if no sequence is found.

◆ search_n() [2/2]

template<typename View1 >
View1::reference stapl::search_n ( View1 const &  v1,
size_t  count,
typename View1::value_type  value 
)

Return the position of the first occurrence of a sequence of the given value which is of the given length, or null_reference if none exists.

Parameters
v1One-dimensional view of input elements.
countLength of sequence of repeated elements to search.
valueValue which is repeated in the searched sequence.
Returns
A reference to the first element of the repeated sequence in the input, or null_reference if none exists.

◆ equal()

template<typename View0 , typename View1 , typename Predicate >
bool stapl::equal ( View0 const &  view0,
View1 const &  view1,
Predicate  predicate 
)

Compares the two input views and returns true if all of their elements compare pairwise equal.

Parameters
view0One-dimensional input view.
view1One-dimensional input view.
predicateBinary functor which implements equality.
Returns
True if the elements in the views are equal, false otherwise.