DATAKIT API  V2025.2
dtk Namespace Reference

Functions

template<typename T , class Predicate >
bool all_of (const Dtk_tab< T > &tab, Predicate Pred)
 Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 
template<class InputIterator , class Predicate >
bool all_of (InputIterator first, InputIterator last, Predicate Pred)
 Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 
template<typename T , class Predicate >
bool any_of (const Dtk_tab< T > &tab, Predicate Pred)
 Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty. More...
 
template<class InputIterator , class Predicate >
bool any_of (InputIterator first, InputIterator last, Predicate Pred)
 Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty. More...
 
template<typename T , class Predicate >
bool none_of (const Dtk_tab< T > &tab, Predicate Pred)
 Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 
template<class InputIterator , class Predicate >
bool none_of (InputIterator first, InputIterator last, Predicate Pred)
 Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 

Function Documentation

◆ all_of() [1/2]

template<typename T , class Predicate >
bool dtk::all_of ( const Dtk_tab< T > &  tab,
Predicate  Pred 
)

Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
Specialized version for Dtk_tab.
1007  {
1008  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1009  if(!Pred(tab[i]))
1010  return false;
1011  return true;
1012  }

◆ all_of() [2/2]

template<class InputIterator , class Predicate >
bool dtk::all_of ( InputIterator  first,
InputIterator  last,
Predicate  Pred 
)

Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
992  { // test if all elements satisfy _Pred
993  for (; first != last; ++first)
994  if (!Pred(*first))
995  return false;
996  return true;
997  }

◆ any_of() [1/2]

template<typename T , class Predicate >
bool dtk::any_of ( const Dtk_tab< T > &  tab,
Predicate  Pred 
)

Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
Specialized version for Dtk_tab.
1036  {
1037  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1038  if(Pred(tab[i]))
1039  return true;
1040  return false;
1041  }

◆ any_of() [2/2]

template<class InputIterator , class Predicate >
bool dtk::any_of ( InputIterator  first,
InputIterator  last,
Predicate  Pred 
)

Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
1021  {
1022  for(; first != last; ++first)
1023  if(Pred(*first))
1024  return true;
1025  return false;
1026  }

◆ none_of() [1/2]

template<typename T , class Predicate >
bool dtk::none_of ( const Dtk_tab< T > &  tab,
Predicate  Pred 
)

Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
Specialized version for Dtk_tab.
1065  {
1066  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1067  if(Pred(tab[i]))
1068  return false;
1069  return true;
1070  }

◆ none_of() [2/2]

template<class InputIterator , class Predicate >
bool dtk::none_of ( InputIterator  first,
InputIterator  last,
Predicate  Pred 
)

Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
1050  {
1051  for (; first != last; ++first)
1052  if (Pred(*first))
1053  return false;
1054  return true;
1055  }
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:712
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:504