Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
TupleConstructor< TYPES, _ElmMapper_ > Struct Template Reference

#include "lib/meta/tuple-helper.hpp"

Description

template<typename TYPES, template< class, class, size_t > class _ElmMapper_>
struct lib::meta::TupleConstructor< TYPES, _ElmMapper_ >

Extensible Adapter to construct a distinct tuple from some arbitrary source type.

This includes the possibility to re-map elements or element positions.

Template Parameters
TYPESsequence of types to use for the tuple
_ElmMapper_a template to extract each constructor argument from the source value. On invocation, we'll pick up the source type from the actual ctor argument, and then invoke this helper template iteratively for each component of the tuple, passing as template arguments
  • the source type, as picked up from the constructor
  • the target tuple type, i.e. Tuple<TYPES>
  • the actual index position of the tuple element to be initialised through this concrete instantiation.
Remarks
this design has several extension points. Pretty much any conceivable initialisation logic can be embodied in the _ElmMapper_ template. Required is that the concrete instance is constructible from the source type and convertible to the individual member type of the target tuple it is invoked for. Source data must be taken by-value, from the ctor argument.
Note
based on this mechanics, a generic element extractor may be built, selecting a (partial) specialisation based on the source type given.
See also
ExtractArg

Definition at line 395 of file tuple-helper.hpp.

Public Types

using SequenceIterator = BuildIdxIter< TYPES >::Ascending
 meta-sequence to drive instantiation of the ElmMapper
 

Static Public Member Functions

template<size_t idx, class SRC >
static auto mapElm (SRC &&init)
 

Public Member Functions

template<class SRC >
 TupleConstructor (SRC &&values)
 

Protected Member Functions

template<class SRC , size_t... idx>
 TupleConstructor (SRC &&initVals, IndexSeq< idx... >)
 

Constructor & Destructor Documentation

◆ TupleConstructor() [1/2]

template<typename TYPES , template< class, class, size_t > class _ElmMapper_>
template<class SRC , size_t... idx>
TupleConstructor ( SRC &&  initVals,
IndexSeq< idx... >   
)
inlineprotected

Definition at line 413 of file tuple-helper.hpp.

◆ TupleConstructor() [2/2]

template<typename TYPES , template< class, class, size_t > class _ElmMapper_>
template<class SRC >
TupleConstructor ( SRC &&  values)
inline

Definition at line 420 of file tuple-helper.hpp.

Member Typedef Documentation

◆ SequenceIterator

template<typename TYPES , template< class, class, size_t > class _ElmMapper_>
using SequenceIterator = BuildIdxIter<TYPES>::Ascending

meta-sequence to drive instantiation of the ElmMapper

Definition at line 399 of file tuple-helper.hpp.

Member Function Documentation

◆ mapElm()

template<typename TYPES , template< class, class, size_t > class _ElmMapper_>
template<size_t idx, class SRC >
static auto mapElm ( SRC &&  init)
inlinestatic
Parameters
initinitialise an instance of the element-mapper

Definition at line 403 of file tuple-helper.hpp.

+ Inheritance diagram for TupleConstructor< TYPES, _ElmMapper_ >:
+ Collaboration diagram for TupleConstructor< TYPES, _ElmMapper_ >:

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