SUNphi  1.0
SUNphi::IntSeq< Ints > Struct Template Reference

#include <IntSeq.hpp>

Inheritance diagram for SUNphi::IntSeq< Ints >:
SUNphi::BaseIntSeq

Classes

struct  _AppendFirstN
 
struct  _AppendFirstN< false, N, IntSeq< R... > >
 
struct  _AppendFirstN< true, N, IntSeq< HeadR, TailR... > >
 

Public Types

template<int I>
using Add = IntSeq<(Ints+I)... >
 Defines a new integer sequence incremented by a constant I.
 
template<int I>
using Sub = Add<-I >
 Defines a new integer sequence decreased by a constant I.
 
template<int I>
using Mul = IntSeq<(Ints *I)... >
 Define a new integer sequence inflated by a constant factor I.
 
template<int I>
using Div = TypeIf< I!=0, Mul< 1/I >>
 Define a new integer sequence decreased by a constant factor I.
 
template<int N, typename ISeq >
using AppendFirstN = typename _AppendFirstN<(N >0), N, ISeq >::type
 

Static Public Member Functions

template<int I>
static constexpr int element ()
 Get the I element of the sequence.
 

Static Public Attributes

static constexpr int size
 Length of the sequence of integer. More...
 
static constexpr std::array< int, sizearray {Ints...}
 Returns a constexpr array containing the Ints.
 
static constexpr int hSum
 Sum of all elements. More...
 
template<int I>
static constexpr int hSumFirst
 Sum of all elements. More...
 
template<int I>
static constexpr int firstNon
 Take first position wher I does not occur. More...
 
static constexpr int hMul
 Product of all elements. More...
 
static constexpr int max
 Returns the maximal element of the list. More...
 
static constexpr int first
 Get the first element of the sequence. More...
 
static constexpr int last
 Get the last element of the sequence. More...
 
static constexpr int isOrdered
 Determine whether the IntSeq elements are ordered or not. More...
 
static constexpr int isOrderedUnique
 Determine whether the IntSeq elements are ordered and different or not. More...
 
template<typename Is , typename = EnableIf<isIntSeq<Is>>>
static constexpr bool isSubsetOf
 

Detailed Description

template<int... Ints>
struct SUNphi::IntSeq< Ints >

A struct holding a sequence of integer (similar to stdlib).

The integers are held as parameters of the class. To intercept them, use the class in a consmett in which the integer list are deduced as template parameter, as in this example:

template <class T>
class PutIntoArrays
{
};
template <int...Ints>
class PutIntoArrays<IntSeq<Ints...>>
{
std::array<int,IntSeq<Ints...>::Size> arr{{Ints...}};
};
Template Parameters
Intsthe list of integer

Definition at line 41 of file IntSeq.hpp.

Member Typedef Documentation

template<int... Ints>
template<int N, typename ISeq >
using SUNphi::IntSeq< Ints >::AppendFirstN = typename _AppendFirstN<(N>0),N,ISeq>::type

Append the first N id of another IntSeq

Gives visibility to internal implementation

Definition at line 191 of file IntSeq.hpp.

Member Data Documentation

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::first
static
Initial value:
=
element<0>()

Get the first element of the sequence.

Definition at line 101 of file IntSeq.hpp.

template<int... Ints>
template<int I>
constexpr int SUNphi::IntSeq< Ints >::firstNon
static
Initial value:
=
SUNphi::firstNon<I,Ints...>

Take first position wher I does not occur.

Definition at line 62 of file IntSeq.hpp.

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::hMul
static
Initial value:
=
SUNphi::hMul<Ints...>

Product of all elements.

Definition at line 66 of file IntSeq.hpp.

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::hSum
static
Initial value:
=
SUNphi::hSum<Ints...>

Sum of all elements.

Definition at line 52 of file IntSeq.hpp.

template<int... Ints>
template<int I>
constexpr int SUNphi::IntSeq< Ints >::hSumFirst
static
Initial value:
=
SUNphi::hSumFirst<I,Ints...>

Sum of all elements.

Definition at line 57 of file IntSeq.hpp.

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::isOrdered
static
Initial value:
=
areOrdered<Ints...>

Determine whether the IntSeq elements are ordered or not.

Definition at line 109 of file IntSeq.hpp.

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::isOrderedUnique
static
Initial value:

Determine whether the IntSeq elements are ordered and different or not.

Definition at line 113 of file IntSeq.hpp.

template<int... Ints>
template<typename Is , typename = EnableIf<isIntSeq<Is>>>
constexpr bool SUNphi::IntSeq< Ints >::isSubsetOf
static
Initial value:
=
((nOf<Ints> ==Is::template nOf<Ints>) & ...)

Determine whether the elements are contained

Example

IntSeq<0,2,2,4>::template has<2>; // true
IntSeq<0,2,2,4>::template has<4,2>; // true
IntSeq<0,2,2,4>::template has<5>; // false
\encode
template <int...El>
static constexpr bool has=
((firstEq<El,Ints...>!=size) & ...);
Returns the number of occurrency of El
Example
\code
IntSeq<0,2,2,4>::template nOf<2>; // 2
IntSeq<0,2,2,4>::template nOf<4>; // 1
IntSeq<0,2,2,4>::template nOf<5>; // 0
\encode
template <int El>
static constexpr int nOf=
SUNphi::hSum<(Ints==El)...>;
Checks if an IntSeq is a subset of the current one
Example
\code
IntSeq<0,2,2>::template isSubsetOf<IntSeq<0,2,2,4>>; // true
IntSeq<0,2,2>::template isSubsetOf<IntSeq<0,2,4>>; // false

Definition at line 149 of file IntSeq.hpp.

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::last
static
Initial value:
=

Get the last element of the sequence.

Definition at line 105 of file IntSeq.hpp.

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::max
static
Initial value:

Returns the maximal element of the list.

Definition at line 90 of file IntSeq.hpp.

template<int... Ints>
constexpr int SUNphi::IntSeq< Ints >::size
static
Initial value:
=
sizeof...(Ints)

Length of the sequence of integer.

Definition at line 45 of file IntSeq.hpp.


The documentation for this struct was generated from the following file: