Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Temple::Tuples Namespace Reference

template metaprogramming metafunctions on tuple types More...

Data Structures

struct  RepeatType
 

Functions

template<typename Tuple , template< typename...> class TemplateFunction>
constexpr auto unpackToFunction ()
 
template<typename TupleType , template< typename > class TemplateFunction>
constexpr auto map ()
 
template<typename TupleType , typename T >
constexpr unsigned countType ()
 Counts how often a type is contained in a tuple type.
 
template<typename TupleType , template< typename > class UnaryPredicate>
constexpr bool allOf ()
 all_of with tuple types and template metafunctions More...
 
template<typename TupleType , template< typename...> class TemplateFunction>
constexpr auto mapAllPairs ()
 Map all pairs of types in a tuple typedefs into a template function. More...
 

Detailed Description

template metaprogramming metafunctions on tuple types

Function Documentation

template<typename TupleType , template< typename > class UnaryPredicate>
constexpr bool Scine::Molassembler::Temple::Tuples::allOf ( )

all_of with tuple types and template metafunctions

Tests whether all types in the tuple return true when evaluated against a predicate

Complexity \(O(N)\)

template<typename TupleType , template< typename > class TemplateFunction>
constexpr auto Scine::Molassembler::Temple::Tuples::map ( )

Takes a tuple type and a template function that accepts a single type at a time and returns an array of the return values of the template function called with the tuple types.

template<typename TupleType , template< typename...> class TemplateFunction>
constexpr auto Scine::Molassembler::Temple::Tuples::mapAllPairs ( )

Map all pairs of types in a tuple typedefs into a template function.

Takes a tuple type and a template function that accepts pairs of the tuple's contained types. Returns an array containing the result of the mapping for all distinct possible type pairs.

With distinct, we mean that pairs of the same types are not created unless a type is explicitly repeated in the tuple type: Say the tuple contains Apple, Banana and Orange, then the generated pairs are: Apple & Banana, Apple & Orange and Banana & Orange.

Complexity \(\Theta(N^2)\)

Template Parameters
TupleTypetuple typedef containing the types whose pairs should be mapped
TemplateFunctiontemplate metafunction with a static constexpr value member or member function
template<typename Tuple , template< typename...> class TemplateFunction>
constexpr auto Scine::Molassembler::Temple::Tuples::unpackToFunction ( )

Takes a tuple type and a template function that accepts all of the tuple's contained types at once and unpacks these as template parameters to the template function, returning it's value.