DUNE-ACFEM (unstable)

Generating sub- and super-tuples and related stuff. More...

Classes

struct  Dune::ACFem::HasPropertyFunctor< Tuple, F >
 

Typedefs

template<class T , std::size_t... I>
using Dune::ACFem::SubTuple = decltype(subTuple< I... >(std::declval< T >()))
 Define the type of a sub-tuple given by an index-pack.
 
template<std::size_t mask, class T >
using Dune::ACFem::MaskTuple = decltype(maskTuple< mask >(std::declval< T >()))
 Define the type a sub-tuple generated by the give bit-mask.
 
template<template< class T, class... > class F, class Tuple >
using Dune::ACFem::FilteredTuple = std::decay_t< decltype(filteredTuple< F >(std::declval< Tuple >()))>
 Generate the type of the return value of filteredTuple().
 
template<class T , class Tuple >
using Dune::ACFem::AddFrontTuple = std::decay_t< decltype(addFront(std::declval< T >(), std::declval< Tuple >()))>
 Type of the tuple where a T is added at the front.
 
template<class T , class Tuple >
using Dune::ACFem::PushBackTuple = std::decay_t< decltype(pushBack(std::declval< T >(), std::declval< Tuple >()))>
 Type of the tuple where a T is added to the end.
 

Functions

template<std::size_t... Pos, class SrcTuple , class DataTuple , bool AssumeSorted = true, std::enable_if_t< AllowsGet< SrcTuple >::value &&AllowsGet< DataTuple >::value, int > = 0>
auto Dune::ACFem::insertAt (SrcTuple &&src, DataTuple &&data, BoolConstant< AssumeSorted >=BoolConstant< AssumeSorted >{})
 Insert the elements of data at positions given by pos into src in turn. More...
 
template<std::size_t Where, class SrcTuple , class Data , bool AssumeSorted = true, std::enable_if_t< AllowsGet< SrcTuple >::value &&!AllowsGet< Data >::value, int > = 0>
auto Dune::ACFem::insertAt (SrcTuple &&src, Data &&data, BoolConstant< AssumeSorted >=BoolConstant< AssumeSorted >{})
 Like the tuple variant, but with single non-tuple value.
 
template<std::size_t... Pos, class SrcTuple , class DataTuple , bool AssumeSorted = true, std::enable_if_t< AllowsGet< SrcTuple >::value &&AllowsGet< DataTuple >::value, int > = 0>
auto Dune::ACFem::insertAt (SrcTuple &&src, DataTuple &&data, IndexSequence< Pos... >, BoolConstant< AssumeSorted >=BoolConstant< AssumeSorted >{})
 Insert-at variant with indices given by index-sequence argument.
 
template<std::size_t Where, class SrcTuple , class Data , bool AssumeSorted = true, std::enable_if_t< AllowsGet< SrcTuple >::value &&!AllowsGet< Data >::value, int > = 0>
auto Dune::ACFem::insertAt (SrcTuple &&src, Data &&data, IndexConstant< Where >, BoolConstant< AssumeSorted >=BoolConstant< AssumeSorted >{})
 Insert-at variant with indices given by index-constant argument.
 
template<std::size_t... I, class TupleLike , std::enable_if_t< IsTupleLike< TupleLike >::value, int > = 0>
auto Dune::ACFem::subTuple (const TupleLike &t, IndexSequence< I... >=IndexSequence< I... >{})
 Extract a sub-tuple by explicit indexing. More...
 
template<std::size_t... I, class TupleLike , std::enable_if_t< IsTupleLike< TupleLike >::value, int > = 0>
auto Dune::ACFem::forwardSubTuple (const TupleLike &t, IndexSequence< I... >=IndexSequence< I... >{})
 Like subTuble() but forward the arguments, possibly in order to be expanded as parameters to another function.
 
template<std::size_t mask, typename... T>
auto Dune::ACFem::maskTuple (const std::tuple< T... > &t, IndexConstant< mask >=IndexConstant< mask >{})
 Generate a sub-tuple with the elements at the positions where a bit in a bit-mask is set. More...
 
template<template< class T, class... > class F, class Tuple >
auto Dune::ACFem::filteredTuple (Tuple &&t)
 Generate a sub-tuple of the elements where F<TupleElement<N, Tuple> > is derived from std::true_type, where N is the index of the respective type in the tuple. More...
 
template<class T , class Tuple , std::enable_if_t< IsTupleLike< Tuple >::value, int > = 0>
constexpr auto Dune::ACFem::addFront (T &&t, Tuple &&tuple)
 Add an element to the front.
 
template<class T , class Tuple , std::enable_if_t< IsTupleLike< Tuple >::value, int > = 0>
constexpr auto Dune::ACFem::pushBack (T &&t, Tuple &&tuple)
 Add an element to the end.
 

Detailed Description

Generating sub- and super-tuples and related stuff.

Function Documentation

◆ filteredTuple()

template<template< class T, class... > class F, class Tuple >
auto Dune::ACFem::filteredTuple ( Tuple &&  t)

Generate a sub-tuple of the elements where F<TupleElement<N, Tuple> > is derived from std::true_type, where N is the index of the respective type in the tuple.

Parameters
[in]tA tuple-like (tuple, pair, array)
[in]fA functor class. F<T> should inspect T and specialize to std::true_type or std::false_type depending on T. F is instantiated with the type of each tuple-element in turn. The fancy variadic argument list for F allows for additional default arguments for F, for instance in order to exploit SFINAE techniques.
Returns
A std::tuple object with the matched elements.

References Dune::ACFem::forwardSubTuple().

◆ insertAt()

template<std::size_t... Pos, class SrcTuple , class DataTuple , bool AssumeSorted = true, std::enable_if_t< AllowsGet< SrcTuple >::value &&AllowsGet< DataTuple >::value, int > = 0>
auto Dune::ACFem::insertAt ( SrcTuple &&  src,
DataTuple &&  data,
BoolConstant< AssumeSorted >  = BoolConstant<AssumeSorted>{} 
)

Insert the elements of data at positions given by pos into src in turn.

In turn means that pos gives the index in the final tuple after inserting each element one after another. E.g.:

data: make_tuple(a, b) pos: index_sequence<2, 4> src: make_tuple(0, 1, 2, 3)

yields:

make_tuple(0, 1, a, 2, b, 3).

◆ maskTuple()

template<std::size_t mask, typename... T>
auto Dune::ACFem::maskTuple ( const std::tuple< T... > &  t,
IndexConstant< mask >  = IndexConstant<mask>{} 
)

Generate a sub-tuple with the elements at the positions where a bit in a bit-mask is set.

The bit mask has to be passed as template-parameter.

Parameters
[in]tSome tuple.
Returns
a std::tuple containing only the elements as specified by the bit-mask

Example which extract the first and third element:

auto sub = maskTuple<0x5>(std::make_tuple(0, 1, 2, 3, 4));

The resulting tuple sub will contain the numbers 0 and 2.

◆ subTuple()

template<std::size_t... I, class TupleLike , std::enable_if_t< IsTupleLike< TupleLike >::value, int > = 0>
auto Dune::ACFem::subTuple ( const TupleLike &  t,
IndexSequence< I... >  = IndexSequence<I...>{} 
)

Extract a sub-tuple by explicit indexing.

Parameters
[in]tSome tuple.
Returns
a std::tuple containing only the elements as specified by the index-sequence.

Example which extract the first and third element:

auto sub = subTuple<0, 2>(std::make_tuple(0, 1, 2, 3, 4);

The resulting tuple sub will contain the numbers 0 and 2.

Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 27, 23:30, 2024)