Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
tuple-closure.hpp File Reference

Partial binding for construction of tuple-like records. More...

Go to the source code of this file.

Description

Partial binding for construction of tuple-like records.

Sometimes tuple-like structures must be created as part of library code, in a situation where some of the values are known and should be fixed-in, while other values need to be supplied late. Obviously this implies creating a functor, and then partially to close some arguments. While seemingly simple, this task is often complicated by the need to support »tuple-like« records, i.e. anything which adheres to the »C++ tuple protocol« (e.g. std::array). Which requires to pick up the actual container type by template pattern match and to rely solely on the helper functions from the STLIB for data access.

A relevant use-case is the handling of invocation parameters for Render Nodes: typically, some parameters are of technical nature and can be configured during the setup-phase of the render network, while other parameters allow the user to exert artistic control and will be supplied later, through automation.

See also
tuple-closure-test.cpp
weaving-pattern-builder.hpp
NodeBuilder_test::build_Node_closedParam()
Remarks
const correctness creates an unfortunate twist here, so that the Wrapper in #wrapBuilder must be declared explicitly (no λ). There must not be several overloaded operator() — otherwise the metaprogramming for detection of the function signature would be defeated, since it relies on decltype(operator())

Definition in file tuple-closure.hpp.

#include "lib/meta/function-closure.hpp"
#include "lib/meta/tuple-helper.hpp"
#include "lib/util.hpp"
#include <utility>
#include <tuple>
#include <array>

Namespaces

namespace  lib
 Implementation namespace for support and library code.
 
namespace  lib::meta
 
namespace  lib::meta::anonymous_namespace{tuple-closure.hpp}
 
namespace  std
 STL namespace.
 

Typedefs

template<typename T , size_t N>
using _AdaptArray_t = _Adapt< T, N >::Array
 

Classes

struct  TupleClosureBuilder< PAR >
 Metaprogramming helper to build a constructor-function for »tuple-like« records, where some of the initialisation values are immediately closed (≙ fixed), while the remaining ones are supplied as function arguments. More...
 
struct  TupleClosureBuilder< TUP< PARS... > >
 
struct  ArrayAdapt< TTT >
 Metaprogramming adapter to overlay a tuple-like signature on top of std::array, with N times the same type. More...
 
struct  AllSame< TTT >
 Metafunction to detect if a type-sequence holds uniform types. More...
 
struct  AllSame< T1, T2, TS... >
 
struct  _Adapt< T, N >
 Type constructor. More...
 
struct  ArrayAdapt< T, TT... >
 
struct  TupleClosureBuilder< std::array< T, N > >
 partial specialisation to handle a std::array. More...
 
struct  tuple_size< lib::meta::ArrayAdapt< TTT... > >
 determine compile-time fixed size of the adapted std::array More...
 
struct  tuple_element< I, lib::meta::ArrayAdapt< TTT... > >
 expose the element type of the adapted std::array More...
 

Functions

template<typename... TTT>
 ArrayAdapt (TTT...) -> ArrayAdapt< std::decay_t< TTT >... >
 

Class Documentation

◆ lib::meta::TupleClosureBuilder

struct lib::meta::TupleClosureBuilder
+ Inheritance diagram for TupleClosureBuilder< PAR >:
+ Collaboration diagram for TupleClosureBuilder< PAR >:

◆ lib::meta::ArrayAdapt

struct lib::meta::ArrayAdapt
+ Collaboration diagram for ArrayAdapt< TTT >:

◆ lib::meta::anonymous_namespace{tuple-closure.hpp}::_Adapt

struct lib::meta::anonymous_namespace{tuple-closure.hpp}::_Adapt
Class Members
typedef Seq NFold
typedef Type Array
+ Collaboration diagram for _Adapt< T, N >: