DATAKIT API  V2025.1
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.
1005  {
1006  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1007  if(!Pred(tab[i]))
1008  return false;
1009  return true;
1010  }

◆ 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.
990  { // test if all elements satisfy _Pred
991  for (; first != last; ++first)
992  if (!Pred(*first))
993  return false;
994  return true;
995  }

◆ 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.
1034  {
1035  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1036  if(Pred(tab[i]))
1037  return true;
1038  return false;
1039  }

◆ 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.
1019  {
1020  for(; first != last; ++first)
1021  if(Pred(*first))
1022  return true;
1023  return false;
1024  }

◆ 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.
1063  {
1064  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1065  if(Pred(tab[i]))
1066  return false;
1067  return true;
1068  }

◆ 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.
1048  {
1049  for (; first != last; ++first)
1050  if (Pred(*first))
1051  return false;
1052  return true;
1053  }
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:502