DATAKIT API  V2025.1
util_stl_dtk.hpp File Reference

Go to the source code of this file.

Data Structures

class  Dtk_greater< T >
 Functor comparison object. More...
 
class  Dtk_less< T >
 Functor comparison object. More...
 
class  Dtk_pair< T1, T2 >
 
class  Dtk_tab< T >
 This is a high level array class. More...
 

Namespaces

 dtk
 

Functions

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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename T >
void Dtk_swap (T &a, T &b)
 Swap any type of data. More...
 
void Dtk_ThrowOverflowException ()
 
template<typename T1 , typename T2 >
Dtk_pair< T1, T2 > make_Dtkpair (T1 &&x, T2 &&y)
 Constructs a pair object with its first element set to x and its second element set to y. More...
 
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. More...
 
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. More...
 

Function Documentation

◆ Dtk_swap()

template<typename T >
void Dtk_swap ( T &  a,
T &  b 
)

Swap any type of data.

Parameters
afirst to swap
bsecond to swap
Remarks
Can swap any types (including pointers)
Reference parameters prevent to get adress, provide an easy using.

Sample:

int a = 5;
int b = 7;
Dtk_swap(a,b); // now a=7 and b=5
stuff a = STUFF1;
stuff b = STUFF2;
Dtk_swap(a,b); // swapped
stuff* a = PSTUFF1;
stuff* b = PSTUFF2;
Dtk_swap(a,b); // swapped
72 {
73  T tmp = std::move( a );
74  a = std::move( b );
75  b = std::move( tmp );
76 }

◆ Dtk_ThrowOverflowException()

void Dtk_ThrowOverflowException ( )

◆ make_Dtkpair()

template<typename T1 , typename T2 >
Dtk_pair<T1, T2> make_Dtkpair ( T1 &&  x,
T2 &&  y 
)

Constructs a pair object with its first element set to x and its second element set to y.

Parameters
xfirst element
ysecond element
Remarks
The template types can be implicitly deduced from the arguments passed to make_Dtkpair.
pair objects can be constructed from other pair objects containing different types, if the respective types are implicitly convertible.

Sample:

foo = make_Dtkpair (10,20);
bar = make_Dtkpair (10.5,'A'); // ok: implicit conversion from pair<double,char>
output:
foo: 10, 20
bar: 10, 65
974 {
975  return Dtk_pair<T1, T2>( std::forward<T1>( x ), std::forward<T2>( y ) );
976 }
Dtk_pair
Definition: util_stl_dtk.hpp:917
make_Dtkpair
Dtk_pair< T1, T2 > make_Dtkpair(T1 &&x, T2 &&y)
Constructs a pair object with its first element set to x and its second element set to y.
Definition: util_stl_dtk.hpp:973
Dtk_swap
void Dtk_swap(T &a, T &b)
Swap any type of data.
Definition: util_stl_dtk.hpp:71