Jive reference manual
Functions
Tuple utility functions

A collection of functions operating on tuples. More...

Functions

template<class T , int M, int N>
jem::min (const TupleExpr< T, M, N > &e)
 Computes the minimum value of a tuple expression. More...
 
template<class T , int M, int N>
jem::max (const TupleExpr< T, M, N > &e)
 Computes the maximum value of a tuple expression. More...
 
template<class T , int M, int N>
jem::sum (const TupleExpr< T, M, N > &e)
 Computes the sum of all elements in a tuple expression. More...
 
template<class T , int M, int N>
jem::product (const TupleExpr< T, M, N > &e)
 Computes the product of all elements in a tuple expression. More...
 
template<class T , int M, int N>
bool jem::testall (const TupleExpr< T, M, N > &e)
 Tests whether all elements in a tuple expression are true. More...
 
template<class T , int M, int N>
bool jem::testany (const TupleExpr< T, M, N > &e)
 Tests whether at least one element in a tuple expression is true. More...
 
template<class T , int M, int N>
bool jem::equal (const TupleExpr< T, M, N > &lhs, const TupleExpr< T, M, N > &rhs)
 Tests whether two tuple expressions are equal. More...
 
template<class T >
Tuple< T, 1 > jem::makeTuple (T a)
 Constructs a one-dimensional tuple of size 1. More...
 
template<class T >
Tuple< T, 2 > jem::makeTuple (T a, T b)
 Constructs a one-dimensional tuple of size 2. More...
 
template<class T >
Tuple< T, 3 > jem::makeTuple (T a, T b, T c)
 Constructs a one-dimensional tuple of size 3. More...
 
template<class T >
Tuple< T, 4 > jem::makeTuple (T a, T b, T c, T d)
 Constructs a one-dimensional tuple of size 4. More...
 

Detailed Description

#include <jem/base/tuple/utilities.h>

This header file exports a collection of functions that perform various operations on Tuple objects and tuple expressions. Supported operations are:

Note that these functions are also available through the general header file <jem/base/Tuple.h>.

Function Documentation

template<class T , int M, int N>
T jem::min ( const TupleExpr< T, M, N > &  e)

Computes the minimum value of the tuple expression or Tuple object e.

Parameters
e- an tuple expression or a Tuple object.
Returns
The smallest element in the tuple.
Precondition
The type T supports the < operator.
template<class T , int M, int N>
T jem::max ( const TupleExpr< T, M, N > &  e)

Computes the minimum value of the tuple expression or Tuple object e.

Parameters
e- an tuple expression or a Tuple object.
Returns
The largest element in the tuple.
Precondition
The type T supports the < operator.
template<class T , int M, int N>
T jem::sum ( const TupleExpr< T, M, N > &  e)

Computes the sum of all elements in the tuple expression or Tuple object e.

Parameters
e- an tuple expression or a Tuple object.
Returns
The sum of all elements in the tuple.
Precondition
The type T supports the + operator.
template<class T , int M, int N>
T jem::product ( const TupleExpr< T, M, N > &  e)

Computes the product of all elements in the tuple expression or Tuple object e.

Parameters
e- an tuple expression or a Tuple object.
Returns
The product of all elements in the tuple.
Precondition
The type T supports the * operator.
template<class T , int M, int N>
bool jem::testall ( const TupleExpr< T, M, N > &  e)

Tests whether all elements in the tuple expression or Tuple object e are true.

Parameters
e- an tuple expression or a Tuple object.
Returns
true if all elements in the tuple evaluate to true, and false otherwise.
Precondition
The type T can be converted to a boolean.
template<class T , int M, int N>
bool jem::testany ( const TupleExpr< T, M, N > &  e)

Tests whether at least one element in the tuple expression or Tuple object e is true.

Parameters
e- an tuple expression or a Tuple object.
Returns
true if at least one elements in the tuple evaluates to true, and false otherwise.
Precondition
The type T can be converted to a boolean.
template<class T , int M, int N>
bool jem::equal ( const TupleExpr< T, M, N > &  lhs,
const TupleExpr< T, M, N > &  rhs 
)

Tests whether the elements of the tuple expressions lhs and rhs are equal.

Parameters
lhs- an tuple expression or a Tuple object.
rhs- another tuple expression or a Tuple object.
Returns
testall( lhs == rhs )
template<class T >
Tuple<T,1> jem::makeTuple ( a)

Constructs a Tuple of size 1 containing the element a.

Parameters
a- the first element in the returned tuple.
Returns
Tuple<T,1>( a )
template<class T >
Tuple<T,2> jem::makeTuple ( a,
b 
)

Constructs a Tuple of size 2 containing the elements (a,b).

Parameters
a- the first element in the returned tuple.
b- the second element in the returned tuple.
Returns
Tuple<T,2>( a, b )
template<class T >
Tuple<T,3> jem::makeTuple ( a,
b,
c 
)

Constructs a Tuple of size 3 containing the elements (a,b,c).

Parameters
a- the first element in the returned tuple.
b- the second element in the returned tuple.
c- the third element in the returned tuple.
Returns
Tuple<T,3>( a, b, c )
template<class T >
Tuple<T,4> jem::makeTuple ( a,
b,
c,
d 
)

Constructs a Tuple of size 4 containing the elements (a,b,c,d).

Parameters
a- the first element in the returned tuple.
b- the second element in the returned tuple.
c- the third element in the returned tuple.
d- the fourth element in the returned tuple.
Returns
Tuple<T,4>( a, b, c, d )