diff --git a/doc/technical/howto/crackNuts.txt b/doc/technical/howto/crackNuts.txt index b3c455115..504c73c6b 100644 --- a/doc/technical/howto/crackNuts.txt +++ b/doc/technical/howto/crackNuts.txt @@ -182,8 +182,7 @@ pick and manipulate individually:: - see 'variadic-argument-picker-test.cpp' - but sometimes it is easier to use the tried and true technique of the Loki-Typelists, which can be programmed recursively, similar to LISP. The »bridge« is to unpack the variadic argument pack - into the `lib::meta::Types` ([yellow-background]#⚠ still broken in 2024# - see https://issues.lumiera.org/ticket/987[#987], use `lib::meta::TySeq` from 'meta/typelist.hpp' as workaround...) + into the `lib::meta::Types` + apply functor to each tuple element:: A common trick is to use `std::apply` in combination with a _fold-expression_ diff --git a/research/try.cpp b/research/try.cpp index 8a3bfbd2c..4d7d3183c 100644 --- a/research/try.cpp +++ b/research/try.cpp @@ -121,7 +121,7 @@ main (int, char**) using Fut = decltype(fun); SHOW_TYPE (_Fun::Sig) - auto wup = buildInvokableWrapper>(bup); + auto wup = buildInvokableWrapper>(bup); using Wup = decltype(wup); using WupSig = _Fun::Sig; @@ -130,7 +130,7 @@ main (int, char**) SHOW_EXPR (sizeof(bup)) SHOW_EXPR (sizeof(wup)) - auto waua = buildInvokableWrapper> (std::bind (fun, 55)); + auto waua = buildInvokableWrapper> (std::bind (fun, 55)); waua (); SHOW_TYPE (_Fun::Sig) diff --git a/src/lib/diff/gen-node.hpp b/src/lib/diff/gen-node.hpp index 5311650b5..fe22ebb20 100644 --- a/src/lib/diff/gen-node.hpp +++ b/src/lib/diff/gen-node.hpp @@ -132,7 +132,7 @@ namespace diff{ using Rec = Record; using RecRef = RecordRef; using MakeRec = Rec::Mutator; - using DataValues = meta::TySeq::Ret; using ArgsList = typename Args::List; using ValList = typename VAL::List; - using ValTypes = typename TySeq::Seq; // reconstruct a type-seq from a type-list + using ValTypes = typename Types::Seq; // reconstruct a type-seq from a type-list enum { ARG_CNT = count() , VAL_CNT = count() @@ -306,8 +306,8 @@ namespace func{ using LeftReduced = typename Splice::Back; using RightReduced = typename Splice::Front; - using ArgsL = typename TySeq::Seq; - using ArgsR = typename TySeq::Seq; + using ArgsL = typename Types::Seq; + using ArgsR = typename Types::Seq; // build a list, where each of the *remaining* arguments is replaced by a placeholder marker @@ -319,8 +319,8 @@ namespace func{ using LeftReplaced = typename Splice::List; using RightReplaced = typename Splice::List; - using LeftReplacedTypes = typename TySeq::Seq; - using RightReplacedTypes = typename TySeq::Seq; + using LeftReplacedTypes = typename Types::Seq; + using RightReplacedTypes = typename Types::Seq; // create a "builder" helper, which accepts exactly the value tuple elements // and puts them at the right location, while default-constructing the remaining @@ -407,7 +407,7 @@ namespace func{ using Args = typename _Fun::Args; using Ret = typename _Fun::Ret; using ArgsList = typename Args::List; - using ValList = typename TySeq::List; + using ValList = typename Types::List; enum { ARG_CNT = count() }; @@ -423,8 +423,8 @@ namespace func{ using PreparedArgs = Prefix; using ReducedArgs = typename Append::List; - using PreparedArgTypes = typename TySeq::Seq; - using RemainingArgs = typename TySeq::Seq; + using PreparedArgTypes = typename Types::Seq; + using RemainingArgs = typename Types::Seq; template diff --git a/src/lib/meta/function.hpp b/src/lib/meta/function.hpp index e2f699248..90f303c67 100644 --- a/src/lib/meta/function.hpp +++ b/src/lib/meta/function.hpp @@ -2,7 +2,7 @@ FUNCTION.hpp - metaprogramming utilities for transforming function types Copyright (C) - 2009, Hermann Vosseler + 2009-2025, Hermann Vosseler   **Lumiera** is free software; you can redistribute it and/or modify it   under the terms of the GNU General Public License as published by the @@ -13,25 +13,66 @@ /** @file function.hpp - ** Metaprogramming tools for transforming functor types. + ** Metaprogramming tools for detecting and transforming function types. ** Sometimes it is necessary to build and remould a function signature, e.g. for ** creating a functor or a closure based on an existing function of function pointer. - ** This is a core task of functional programming, but sadly C++ in its current shape - ** is still lacking in this area. (C++11 significantly improved this situation). - ** As an \em pragmatic fix, we define here a collection of templates, specialising - ** them in a very repetitive way for up to 9 function arguments. Doing so enables - ** us to capture a function, access the return type and argument types as a typelist, - ** eventually to manipulate them and re-build a different signature, or to create - ** specifically tailored bindings. + ** Functors, especially in the form of Lambdas, can be used to parametrise a common + ** skeleton of computation logic to make it work with concrete implementation parts + ** tied directly to the actual usage. A _functor centric_ approach places the focus + ** on the _computation structure_ and often complements the more _object centric_ one, + ** where relations and responsibilities are structured and built from building blocks + ** with fixed type relations. ** - ** If the following code makes you feel like vomiting, please look away, - ** and rest assured: you aren't alone. + ** However, handling arbitrary functions as part of a common structure scheme requires + ** to cope with generally unknown argument and result types. Notably the number and + ** sequence of the expected arguments of an unknown function can be arbitrary, which + ** places the onus upon the handling and receiving context to adapt to actual result + ** types and to provide suitable invocation arguments. Typically, failure to do so + ** will produce a sway of almost impenetrable compilation failure messages, making + ** the reason of the failure difficult to spot. So to handle this challenge, ways + ** to inspect and isolate parts of the function's _signature_ become essential. ** - ** @todo get rid of the repetitive specialisations - ** and use variadic templates to represent the arguments /////////////////////////////////TICKET #994 + ** The _trait template_ [_Fun](\ref lib::meta::_Fun) is the entrance point to + ** extract information regarding the function signature at compile time. Defined as + ** a series partial template specialisations, it allows to create a level playing field + ** and abstract over the wide array of different flavours of »invokable entities«: + ** this can be direct references to some function in the code, function pointers, + ** pointers to function members of an object, generally any object with an _function call_ + ** `operator()`, and especially the relevant features of the standard library, which are + ** the generic function adapter `std::function` and the _binder_ objects created when + ** _partially closing_ (binding) some function arguments ahead of the actual invocation. + ** And last but not least the _Lambda functions_, which represent an abstracted, opaque + ** and anonymous function and are supported by a special syntactical construct, allowing + ** to pass _blocks of C++ code_ directly as argument to some other function or object. ** + ** Code to control the process of compilation, by detecting some aspects of the involved + ** types and react accordingly, is a form of **metaprogramming** — and allows for dynamic + ** **code generation** right from the ongoing compilation process. The flexible and open + ** nature of function arguments often directly leads into such metaprogramming tasks. + ** While the contemporary C++ language offers the language construct of _variadics_, + ** such variadic template argument packs can only be dissected and processed further + ** by instantiating another template with the argument pack and then exploiting + ** _partial template specialisation_ to perform a _pattern match_ against the variadic + ** arguments. Sometimes this approach comes in natural, yet in many commonplace situations + ** if feels kind of »backwards« and leads to very tricky, hard to decipher template code. + ** The Lumiera support library thus offers special features to handle _type sequences_ + ** and _type lists_ directly, allowing to process by recursive list programming patterns + ** as known from the LISP language. The `_Fun` trait mentioned above directly provides + ** an entrance point to this kind of in-compilation programming, as it exposes a nested + ** type definition `_Fun::Args`, which is an instance of the **type sequence** template + ** \ref lib::meta::Types. This in turn exposes a nested type definition `List`, leading + ** to the [Loki Type Lists](\ref typelist.hpp). + ** + ** Furthermore, this header defines some very widely used abbreviations for the most + ** common tasks of detecting aspects of a function. These are often used in conjunction + ** with the _constexpr if_ available since C++17: + ** - _FunRet is a templated type definition to extract the return type + ** - _FunArg extracts the type of single-arg function and fails compilation else + ** - has_Arity is a _meta-function_ to check for a specific number of arguments + ** - is_NullaryFun, is_UnaryFun, is_BinaryFun, is_TernaryFun (common abbreviations) + ** - the metafunction has_Sig is often placed close to the entrance point of an + ** elaborate, template based ecosystem and helps to produce better error messages ** - ** @see control::CommandDef usage example ** @see function-closure.hpp generic function application ** @see typelist.hpp ** @see tuple.hpp @@ -55,24 +96,25 @@ namespace meta{ using std::function; - /** - * Helper for uniform access to function signature types. - * Extract the type information contained in a function or functor type, + /**************************************************************************//** + * Trait template for uniform access to function signature types. + * Extracts the type information contained in a function or functor type, * so it can be manipulated by metaprogramming. This template works on * anything _function like_, irrespective if the parameter is given * as function reference, function pointer, member function pointer, * functor object, `std::function` or lambda. The embedded typedefs - * allow to pick up + * allow to expose * - `Ret` : the return type * - `Args`: the sequence of argument types as type sequence `Types` * - `Sig` : the bare function signature type * - `Functor` : corresponding Functor type which can be instantiated or copied. + * - `ARITY` : number of arguments * * This template can also be used in metaprogramming with `enable_if` to enable * some definition or specialisation only if a function-like type was detected; thus * the base case holds no nested type definitions and inherits from std::false_type. - * The primary, catch-all case gets activated whenever on functor objects, i.e. anything - * with an `operator()`. + * The primary, catch-all case gets activated whenever used on functor objects + * proper, i.e. anything with an `operator()`. * The following explicit specialisations handle the other cases, which are * not objects, but primitive types (function (member) pointers and references). * @remarks The key trick of this solution is to rely on `decltype` of `operator()` @@ -86,6 +128,7 @@ namespace meta{ * - when there are several overloads of `operator()` * - when the function call operator is templated * - on *generic lambdas* + * - on results of std::bind * All these cases will activate the base (false) case, as if the * tested subject was not a function at all. Generally speaking, * it is _not possible_ to probe a generic lambda or templated function, @@ -116,7 +159,7 @@ namespace meta{ : std::true_type { using Ret = RET; - using Args = TySeq; + using Args = Types; using Sig = RET(ARGS...); using Functor = std::function; enum { ARITY = sizeof...(ARGS) }; @@ -182,6 +225,29 @@ namespace meta{ + /** + * Build function types from given Argument types. + * As embedded typedefs, you'll find a std::function #Func + * and the bare function signature #Sig + * @param RET the function return type + * @param ARGS a type sequence describing the arguments + */ + template + struct BuildFunType; + + template + struct BuildFunType> + { + using Sig = RET(ARGS...); + using Fun = _Fun; + using Func = function; + using Functor = Func; + }; + + + + + /** abbreviation for referring to a function's return type */ template using _FunRet = typename _Fun::Ret; @@ -329,187 +395,5 @@ namespace meta{ - - - - - /** - * Build function types from given Argument types. - * As embedded typedefs, you'll find a tr1 functor #Func - * and the bare function signature #Sig - * @param RET the function return type - * @param ARGS a type sequence describing the arguments - */ //////////////////////////////////////////////////////////////////////TICKET #987 : make lib::meta::Types variadic, then replace this by a single variadic template - template - struct BuildFunType; - - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : this specialisation handles the variadic case and will be the only definition in future - template - struct BuildFunType> - { - using Sig = RET(ARGS...); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisations become obsolete with the old-style type-sequence - template< typename RET> - struct BuildFunType > - { - using Sig = RET(void); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - > - struct BuildFunType> - { - using Sig = RET(A1); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - > - struct BuildFunType> - { - using Sig = RET(A1,A2); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - , typename A3 - > - struct BuildFunType> - { - using Sig = RET(A1,A2,A3); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - , typename A3 - , typename A4 - > - struct BuildFunType> - { - using Sig = RET(A1,A2,A3,A4); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - , typename A3 - , typename A4 - , typename A5 - > - struct BuildFunType> - { - using Sig = RET(A1,A2,A3,A4,A5); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - , typename A3 - , typename A4 - , typename A5 - , typename A6 - > - struct BuildFunType> - { - using Sig = RET(A1,A2,A3,A4,A5,A6); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - , typename A3 - , typename A4 - , typename A5 - , typename A6 - , typename A7 - > - struct BuildFunType> - { - using Sig = RET(A1,A2,A3,A4,A5,A6,A7); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - , typename A3 - , typename A4 - , typename A5 - , typename A6 - , typename A7 - , typename A8 - > - struct BuildFunType> - { - using Sig = RET(A1,A2,A3,A4,A5,A6,A7,A8); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - template< typename RET - , typename A1 - , typename A2 - , typename A3 - , typename A4 - , typename A5 - , typename A6 - , typename A7 - , typename A8 - , typename A9 - > - struct BuildFunType> - { - using Sig = RET(A1,A2,A3,A4,A5,A6,A7,A8,A9); - using Fun = _Fun; - using Func = function; - using Functor = Func; - }; - - - - - }} // namespace lib::meta #endif diff --git a/src/lib/meta/tuple-closure.hpp b/src/lib/meta/tuple-closure.hpp index 40254fe52..ec7dbe2f6 100644 --- a/src/lib/meta/tuple-closure.hpp +++ b/src/lib/meta/tuple-closure.hpp @@ -93,7 +93,7 @@ namespace meta{ static auto closeFront (VALS&& ...vs) { - using ClosedTypes = TySeq...>; + using ClosedTypes = Types...>; auto boundArgs = std::make_tuple (std::forward (vs)...); // Note: must be passed by-val here return wrapBuilder (func::PApply::bindFront (buildRecord, move(boundArgs))); } @@ -104,7 +104,7 @@ namespace meta{ static auto closeBack (VALS&& ...vs) { - using ClosedTypes = TySeq...>; + using ClosedTypes = Types...>; auto boundArgs = std::make_tuple (std::forward (vs)...); return wrapBuilder (func::PApply::bindBack (buildRecord, move(boundArgs))); } diff --git a/src/lib/meta/tuple-helper.hpp b/src/lib/meta/tuple-helper.hpp index db300f45b..8829635b0 100644 --- a/src/lib/meta/tuple-helper.hpp +++ b/src/lib/meta/tuple-helper.hpp @@ -14,20 +14,13 @@ /** @file tuple-helper.hpp ** Metaprogramming with tuples-of-types and the `std::tuple` record. - ** The metaprogramming part of this header complements typelist.hpp and allows - ** some additional manipulations on type sequences, especially to integrate - ** with the Tuples provided by the standard library. + ** This header complements typelist.hpp and provides a bridge from type sequences + ** to the tuple type provided by the standard library, including traits and + ** helpers to build tuple types from metaprogramming and to pretty-print tuples. ** - ** @warning the metaprogramming part of Lumiera to deal with type sequences is in a - ** state of transition, since C++11 now offers direct language support for - ** processing of flexible template parameter sequences ("parameter packs"). - ** It is planned to regroup and simplify our homemade type sequence framework - ** to rely on variadic templates and integrate better with std::tuple. - ** It is clear that we will _retain some parts_ of our own framework, - ** since programming with _Loki-style typelists_ is way more obvious - ** and straight forward than handling of template parameter packs, - ** since the latter can only be rebound through pattern matching. - ** @todo transition lib::meta::Types to variadic parameters /////////////////////////////////TICKET #987 + ** Furthermore, a generic iteration construct is provided, to instantiate + ** a generic Lambda for each element of a given tuple, which allows to write + ** generic code »for each tuple element«. ** ** @see control::CommandDef usage example ** @see TupleHelper_test @@ -142,27 +135,15 @@ namespace meta { { }; template - struct BuildTupleType> + struct BuildTupleType> { using Type = std::tuple; }; - /** - * temporary workaround: strip trailing Nil-Type entries - * prior to rebinding to the `std::tuple` type. - */ - template - struct BuildTupleType> - { - using VariadicSeq = typename StripNil>::Seq; - - using Type = typename BuildTupleType::Type; - }; - template struct BuildTupleType> { - using Seq = typename TySeq>::Seq; + using Seq = typename Types>::Seq; using Type = typename BuildTupleType::Type; }; @@ -195,13 +176,13 @@ namespace meta { template struct RebindTupleTypes { - using Seq = typename TySeq::Seq; + using Seq = typename Types::Seq; using List = typename Seq::List; }; template struct RebindTupleTypes> { - using Seq = typename TySeq::Seq; + using Seq = typename Types::Seq; using List = typename Seq::List; }; @@ -349,29 +330,16 @@ namespace meta { }; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : this specialisation handles the variadic case and will be the only definition in future template < template class _X_ , class TUP , uint i > - class BuildTupleAccessor< _X_, TySeq<>, TUP, i> + class BuildTupleAccessor< _X_, Types<>, TUP, i> { public: using Product = _X_; // Note: i == tuple size }; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation will be obsoleted by the removal of old-style type-sequences - template - < template class _X_ - , class TUP - , uint i - > - class BuildTupleAccessor< _X_, TyOLD<>, TUP, i> - { - public: - using Product = _X_; // Note: i == tuple size - - }; @@ -431,7 +399,7 @@ namespace meta { inline std::string dump (std::tuple const& tuple) { - using BuildAccessor = BuildTupleAccessor>; + using BuildAccessor = BuildTupleAccessor>; using Displayer = typename BuildAccessor::Product ; return static_cast (tuple) diff --git a/src/lib/meta/tuple-record-init.hpp b/src/lib/meta/tuple-record-init.hpp index 09ad9ddd9..6ac6e7247 100644 --- a/src/lib/meta/tuple-record-init.hpp +++ b/src/lib/meta/tuple-record-init.hpp @@ -193,7 +193,7 @@ namespace meta { struct ElementExtractor> { template - using TargetType = typename Pick, i>::Type; + using TargetType = typename Pick, i>::Type; template diff --git a/src/lib/meta/typelist.hpp b/src/lib/meta/typelist.hpp index e58ff839d..fd80e16d1 100644 --- a/src/lib/meta/typelist.hpp +++ b/src/lib/meta/typelist.hpp @@ -37,7 +37,7 @@ This code is heavily inspired by ** The latter brings LISP style recursive manipulation techniques into the ** realm of type metaprogramming; this approach was pioneered with the ** **Loki Library** by Alexandrescu (2001) and makes complex processing - ** much easier to write and to understand following. Effectively the set + ** much easier to write and to follow for the reader. Effectively the set ** of definitions used here is a tailored version of what could be found ** in the Loki library, and was in the following years integrated with ** processing of variadics, function manipulation and std::tuple. @@ -58,17 +58,6 @@ This code is heavily inspired by ** effectively this is a flavour of functional programming; the _execution environment_ ** is the compiler, and evaluation is set off by some template instantiation. ** - ** @warning the metaprogramming part of Lumiera to deal with type sequences is in a - ** state of transition, since C++11 now offers direct language support for - ** processing of flexible template parameter sequences ("parameter packs"). - ** It is planned to regroup and simplify our homemade type sequence framework - ** to rely on variadic templates and integrate better with std::tuple. - ** It is clear that we will _retain some parts_ of our own framework, - ** since programming with _Loki-style typelists_ is way more obvious - ** and straight forward than handling of template parameter packs, - ** since the latter can only be rebound through pattern matching. - ** @todo transition lib::meta::Types to variadic parameters /////////////////////////////////TICKET #987 - ** ** @see TypeList_test ** @see TypeListManip_test ** @see TypeSecManip_test @@ -107,81 +96,23 @@ namespace meta { using NilNode = Node; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 : this is the old non-variadic definition from lib Loki -- it will be obsoleted with the transition - template - < class T01=Nil - , class T02=Nil - , class T03=Nil - , class T04=Nil - , class T05=Nil - , class T06=Nil - , class T07=Nil - , class T08=Nil - , class T09=Nil - , class T10=Nil - , class T11=Nil - , class T12=Nil - , class T13=Nil - , class T14=Nil - , class T15=Nil - , class T16=Nil - , class T17=Nil - , class T18=Nil - , class T19=Nil - , class T20=Nil - > - class TyOLD - { - typedef typename TyOLD< T02, T03, T04 - , T05, T06, T07, T08 - , T09, T10, T11, T12 - , T13, T14, T15, T16 - , T17, T18, T19, T20>::List ListTail; - public: - using List = Node; - using Seq = TyOLD; - }; - - template<> - struct TyOLD<> - { - using List = Nil; - using Seq = TyOLD<>; - }; - - - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND -- transition to variadic type-sequences - /** - * temporary workaround: - * alternative definition of "type sequence", - * already using variadic template parameters. - * @remarks the problem with our existing type sequence type - * is that it fills the end of each sequence with Nil, - * which was the only way to get a flexible type sequence - * prior to C++11. Unfortunately these trailing Nil - * entries do not play well with other variadic defs. - * @deprecated when we switch our primary type sequence type - * to variadic parameters, this type will be obsoleted. ////////////////////////////////////TICKET #987 : make lib::meta::Types variadic - * @todo 6/25 the transition is now mostly settled - * and will be completed by just _renaming_ this - * definition back into `Types<...>` - */ + + /** variadic sequence of types */ template - struct TySeq; + struct Types; template - struct TySeq + struct Types { - using List = Node::List>; - using Seq = TySeq; + using List = Node::List>; + using Seq = Types; }; template<> - struct TySeq<> + struct Types<> { using List = Nil; - using Seq = TySeq<>; + using Seq = Types<>; }; }} // namespace lib::meta diff --git a/src/lib/meta/typeseq-util.hpp b/src/lib/meta/typeseq-util.hpp index 13546dd52..5f3f0b0e0 100644 --- a/src/lib/meta/typeseq-util.hpp +++ b/src/lib/meta/typeseq-util.hpp @@ -22,17 +22,6 @@ ** - shifting a type sequence ** - re-generating a type sequence from a typelist. ** - ** @warning the metaprogramming part of Lumiera to deal with type sequences is in a - ** state of transition, since C++11 now offers direct language support for - ** processing of flexible template parameter sequences ("parameter packs"). - ** It is planned to regroup and simplify our homemade type sequence framework - ** to rely on variadic templates and integrate better with std::tuple. - ** It is clear that we will _retain some parts_ of our own framework, - ** since programming with _Loki-style typelists_ is way more obvious - ** and straight forward than handling of template parameter packs, - ** since the latter can only be rebound through pattern matching. - ** @todo transition lib::meta::Types to variadic parameters /////////////////////////////////TICKET #987 - ** ** @see typeseq-manip-test.cpp ** @see typelist.hpp ** @see typelist-util.hpp @@ -88,11 +77,7 @@ namespace meta { : SizConst { }; template - struct count> - : SizConst - { }; - template - struct count> + struct count> : SizConst { }; @@ -101,78 +86,15 @@ namespace meta { * Helper: prepend a type to an existing type sequence, * thus shifting all elements within the sequence * to the right, eventually dropping the last element - * @todo support variadic type-seq ////////////////////////////////////////////////////////////////TICKET #987 : make lib::meta::Types variadic, then replace this by a single variadic template */ template struct Prepend; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation will be obsoleted by the removal of old-style type-sequences - template< typename T01 - , typename T02 - , typename T03 - , typename T04 - , typename T05 - , typename T06 - , typename T07 - , typename T08 - , typename T09 - , typename T10 - , typename T11 - , typename T12 - , typename T13 - , typename T14 - , typename T15 - , typename T16 - , typename T17 - , typename T18 - , typename T19 - , typename T20 - , typename IGN - > - struct Prepend > - { - typedef TyOLD< T01,T02,T03,T04,T05 - , T06,T07,T08,T09,T10 - , T11,T12,T13,T14,T15 - , T16,T17,T18,T19,T20 > Seq; - - typedef typename Seq::List List; - }; - - - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND -- to be obsoleted - /** - * Additional specialisation of the basic type sequence type, - * allowing to re-create a (flat) type sequence from a typelist. - */ - template - struct TyOLD< Node > - { - typedef Node List; - - typedef typename Prepend< H - , typename TyOLD::Seq - >::Seq Seq; - }; - - - - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND -- to be obsoleted - /** - * temporary workaround: additional specialisation for the template - * `Prepend` to work also with the (alternative) variadic TySeq. - * @see typeseq-util.hpp - */ template - struct Prepend> + struct Prepend> { - using Seq = TySeq; - using List = typename TySeq::List; + using Seq = Types; + using List = typename Types::List; }; @@ -180,157 +102,73 @@ namespace meta { /** * Additional specialisation of the basic type sequence type, * allowing to re-create a (flat) type sequence from a typelist. + * @remark can now be built with the help of \ref Prepend. */ template - struct TySeq< Node > + struct Types< Node > { using List = Node; using Seq = typename Prepend< H - , typename TySeq::Seq + , typename Types::Seq >::Seq; }; template<> - struct TySeq + struct Types { using List = Nil; - using Seq = TySeq<>; + using Seq = Types<>; }; template<> - struct TySeq - : TySeq + struct Types + : Types { }; - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND -- to be obsoleted - /** - * temporary workaround: strip trailing Nil entries from a - * type sequence, to make it compatible with new-style variadic - * template definitions. - * @note the result type is a TySec, to keep it apart from our - * legacy (non-variadic) lib::meta::Types - * @deprecated necessary for the transition to variadic sequences ////////////////////////////////////TICKET #987 : make lib::meta::Types variadic - */ - template - struct StripNil; - - template - struct StripNil> - { - using TailSeq = typename StripNil>::Seq; - - using Seq = typename Prepend::Seq; - }; - - template - struct StripNil> - { - using Seq = TySeq<>; // NOTE: this causes the result to be a TySeq - }; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation is a catch-all and becomes obsolete - template - struct StripNil> - { - using Seq = TySeq; - }; - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND(End) -- to be obsoleted /** Helper: separate parts of a type sequence - * @todo support variadic type-seq ////////////////////////////////////////////////////////////////TICKET #987 : make lib::meta::Types variadic, then replace this by a single variadic template */ template struct Split; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : this specialisation handles the variadic case and will be the only definition in future template - struct Split > + struct Split > { - using List = typename TySeq::List; + using List = typename Types::List; using Head = T1; - using First = TySeq; - using Tail = TySeq; + using First = Types; + using Tail = Types; // for finding the end we need the help of typelist-util.hpp using PrefixList = typename PickLast::List; using TailList = typename Tail::List; - using Prefix = typename TySeq::Seq; + using Prefix = typename Types::Seq; using End = typename PickLast::Type; - using Last = TySeq; + using Last = Types; }; template<> - struct Split> + struct Split> { using List = Nil; using Head = Nil; - using First = TySeq<>; - using Tail = TySeq<>; + using First = Types<>; + using Tail = Types<>; // for finding the end we need the help of typelist-util.hpp using PrefixList = Nil; using TailList = Nil; - using Prefix = TySeq<>; - using Last = TySeq<>; + using Prefix = Types<>; + using Last = Types<>; using End = Nil; }; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisation will be obsoleted by the removal of old-style type-sequences - template< typename T01 - , typename T02 - , typename T03 - , typename T04 - , typename T05 - , typename T06 - , typename T07 - , typename T08 - , typename T09 - , typename T10 - , typename T11 - , typename T12 - , typename T13 - , typename T14 - , typename T15 - , typename T16 - , typename T17 - , typename T18 - , typename T19 - , typename T20 - > - struct Split > - { - typedef typename - TyOLD< T01,T02,T03,T04,T05 - , T06,T07,T08,T09,T10 - , T11,T12,T13,T14,T15 - , T16,T17,T18,T19,T20 - >::List List; - - typedef T01 Head; - typedef TyOLD< T01 > First; - typedef TyOLD< T02,T03,T04,T05 - , T06,T07,T08,T09,T10 - , T11,T12,T13,T14,T15 - , T16,T17,T18,T19,T20 > Tail; - - // for finding the end we need the help of typelist-util.hpp - - typedef typename PickLast::List PrefixList; - typedef typename Tail::List TailList; - - typedef typename TyOLD::Seq Prefix; - typedef typename PickLast::Type End; - typedef TyOLD Last; - }; @@ -362,14 +200,9 @@ namespace meta { * @see typelist-manip.hpp */ template - struct Pick, i> + struct Pick, i> { - using Type = typename lib::meta::Shifted, i>::Head; - }; - template - struct Pick, i> - { - using Type = typename Shifted, i>::Head; + using Type = typename Shifted, i>::Head; }; @@ -388,7 +221,7 @@ namespace meta { template struct Repeat { - using Seq = TySeq<>; + using Seq = Types<>; }; diff --git a/src/lib/meta/variadic-helper.hpp b/src/lib/meta/variadic-helper.hpp index 6f4eb57e2..b23f6e079 100644 --- a/src/lib/meta/variadic-helper.hpp +++ b/src/lib/meta/variadic-helper.hpp @@ -20,18 +20,13 @@ ** lists _at compile time,_ driven by template instantiation, allowing to specialise ** and react specifically on some concrete pattern of argument types. ** - ** @warning the metaprogramming part of Lumiera to deal with type sequences is in a - ** state of transition, since C++11 now offers direct language support for - ** processing of flexible template parameter sequences ("parameter packs"). - ** It is planned to regroup and simplify our homemade type sequence framework - ** to rely on variadic templates and integrate better with std::tuple. - ** It is clear that we will _retain some parts_ of our own framework, - ** since programming with _Loki-style typelists_ is way more obvious - ** and straight forward than handling of template parameter packs, - ** since the latter can only be rebound through pattern matching. - ** @todo transition lib::meta::Types to variadic parameters /////////////////////////////////TICKET #987 - ** - ** @see control::CommandDef usage example + ** @remark in Lumiera, over time three different approaches were developed for + ** handling sequences of types in metaprogramming; some of these techniques + ** are better suited for specific kinds of tasks than others + ** - templates with variadic arguments (e.g. std::tuple) can be manipulated directly + ** - a type-sequence `Types` can be primed / rebound from other variadic templates + ** - Loki-style type-lists are created from type-sequences and enable elaborate manipulations + ** @see feed-manifold.hpp advanced usage example in the Render Engine ** @see TupleHelper_test ** @see typelist.hpp ** @see function.hpp @@ -140,32 +135,8 @@ namespace meta { }; /** build an index number sequence from a type sequence */ - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND -- to be obsoleted template - struct BuildIdxIter> - { - ///////////////////////TICKET #987 : since Types is not variadic, need to strip Nil-Type here (instead of just using sizeof...(TYPES) - enum {SIZ = lib::meta::count::List>::value }; - using Builder = BuildIndexSeq; - - using Ascending = typename Builder::Ascending; - using Descending = typename Builder::Descending; - - template - using OffsetBy = typename Builder::template OffsetBy; - - template - using FilledWith = typename Builder::template FilledWith; - - template - using First = typename Builder::template First; - - template - using After = typename Builder::template After; - }; - //////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #987 temporary WORKAROUND(END) - template - struct BuildIdxIter> + struct BuildIdxIter> : BuildIdxIter { }; @@ -196,11 +167,11 @@ namespace meta { { static constexpr size_t SIZ = 1; using Idx = std::index_sequence; - using Seq = TySeq; + using Seq = Types; using Tup = std::tuple; template class META> - using Apply = TySeq>; + using Apply = Types>; template class O> using Rebind = O; template class PRED> @@ -211,15 +182,15 @@ namespace meta { /** Partial specialisation to handle type sequences */ template - struct ElmTypes> + struct ElmTypes> { static constexpr size_t SIZ = sizeof...(TYPES); using Idx = std::make_index_sequence; - using Seq = TySeq; + using Seq = Types; using Tup = std::tuple; template class META> - using Apply = TySeq...>; + using Apply = Types...>; template class O> using Rebind = typename lib::meta::RebindVariadic::Type; @@ -242,7 +213,7 @@ namespace meta { template struct Extract> { - using ElmTypes = TySeq::type ...>; + using ElmTypes = Types::type ...>; }; static constexpr size_t SIZ = std::tuple_size::value; @@ -315,7 +286,7 @@ namespace meta { return lib::meta::count(); else { // Fallback: rebind template arguments into a type sequence - using Seq = typename RebindVariadic::Type; + using Seq = typename RebindVariadic::Type; return size_t(count()); } }; diff --git a/src/lib/parse.hpp b/src/lib/parse.hpp index 4f483d6c1..159ae8635 100644 --- a/src/lib/parse.hpp +++ b/src/lib/parse.hpp @@ -392,7 +392,7 @@ namespace util { : tuple { static constexpr size_t N = sizeof...(RESULTS); - using Seq = lib::meta::TySeq; + using Seq = lib::meta::Types; using Tup = std::tuple; SeqModel() = default; diff --git a/src/lib/time/formats.hpp b/src/lib/time/formats.hpp index 2edd02e83..1c5ce0e7f 100644 --- a/src/lib/time/formats.hpp +++ b/src/lib/time/formats.hpp @@ -166,7 +166,7 @@ namespace time { /* == Descriptor to define Support for specific formats == */ - using lib::meta::TySeq; + using lib::meta::Types; using lib::meta::Node; using lib::meta::Nil; @@ -238,7 +238,7 @@ namespace time { : Supported { SupportStandardTimecode() - : Supported(formats< TySeq >()) + : Supported(formats< Types >()) { } }; diff --git a/src/lib/variant.hpp b/src/lib/variant.hpp index 05aada5c3..0351c205b 100644 --- a/src/lib/variant.hpp +++ b/src/lib/variant.hpp @@ -98,7 +98,7 @@ namespace lib { namespace variant { // implementation metaprogramming helpers using std::remove_reference; - using meta::TySeq; + using meta::Types; using meta::Node; using meta::Nil; @@ -159,8 +159,8 @@ namespace lib { }; template class _P_> - struct FirstMatchingType, _P_> - : FirstMatchingType::List, _P_> + struct FirstMatchingType, _P_> + : FirstMatchingType::List, _P_> { }; template class _P_> diff --git a/src/lib/visitor.hpp b/src/lib/visitor.hpp index 1494e2570..5e13005b5 100644 --- a/src/lib/visitor.hpp +++ b/src/lib/visitor.hpp @@ -171,7 +171,7 @@ namespace visitor { } }; - using typelist::TySeq; // convenience for the user of "Applicable" + using typelist::Types; // convenience for the user of "Applicable" diff --git a/src/lib/wrapperptr.hpp b/src/lib/wrapperptr.hpp index d7d1828ab..fc19ff3de 100644 --- a/src/lib/wrapperptr.hpp +++ b/src/lib/wrapperptr.hpp @@ -36,7 +36,7 @@ namespace steam { namespace mobject { class MObject; } - using WrapperTypes = lib::meta::TySeq< mobject::Placement* + using WrapperTypes = lib::meta::Types< mobject::Placement* , lib::P* > ::List; } diff --git a/src/stage/interact/view-spec-dsl.hpp b/src/stage/interact/view-spec-dsl.hpp index becf03a12..603283fe3 100644 --- a/src/stage/interact/view-spec-dsl.hpp +++ b/src/stage/interact/view-spec-dsl.hpp @@ -207,7 +207,7 @@ namespace interact { using lib::meta::_Fun; using lib::meta::Split; using lib::meta::Tuple; - using lib::meta::TySeq; + using lib::meta::Types; using lib::meta::func::PApply; typedef typename _Fun::Ret Ret; @@ -219,7 +219,7 @@ namespace interact { "Allocator function must accept UICoordinates (where to create/locate) as first argument"); static_assert (std::is_convertible::value, "Allocator function must produce UICoordinates (of the actually allocated UI element)"); - static_assert (std::is_convertible>::value, + static_assert (std::is_convertible>::value, "Additional parameters of the allocator function must match the AllocSpec template parameters"); diff --git a/src/stage/model/element-access.hpp b/src/stage/model/element-access.hpp index af13a2bc2..d9548c3e4 100644 --- a/src/stage/model/element-access.hpp +++ b/src/stage/model/element-access.hpp @@ -63,7 +63,7 @@ namespace model { namespace error = lumiera::error; using interact::UICoord; - using lib::meta::TySeq; + using lib::meta::Types; using std::string; class Tangible; @@ -91,7 +91,7 @@ namespace model { protected: - using RawResult = lib::Variant>; + using RawResult = lib::Variant>; /** @internal drill down according to coordinates, maybe create element */ virtual RawResult performAccessTo (UICoord::Builder &, size_t limitCreation) =0; diff --git a/src/steam/config-resolver.hpp b/src/steam/config-resolver.hpp index 32084b363..cdecb0de4 100644 --- a/src/steam/config-resolver.hpp +++ b/src/steam/config-resolver.hpp @@ -61,7 +61,7 @@ namespace steam { * the list of all concrete types participating in the * rule based config query system */ - using InterfaceTypes = lib::meta::TySeq < steam::mobject::session::Fork + using InterfaceTypes = lib::meta::Types < steam::mobject::session::Fork , steam::asset::Pipe , const steam::asset::ProcPatt , steam::asset::Timeline diff --git a/src/steam/control/argument-tuple-accept.hpp b/src/steam/control/argument-tuple-accept.hpp index f2c50e44f..3429546c1 100644 --- a/src/steam/control/argument-tuple-accept.hpp +++ b/src/steam/control/argument-tuple-accept.hpp @@ -36,8 +36,6 @@ ** when the provided arguments don't fit the (hidden) function signature embedded ** within the CommandMutation (functor). ** - ** @todo switch to variadic templates. Requires a rework of Types<...> /////////////////////////////////////TICKET #967 - ** ** @see Command ** @see CommandDef ** @see argument-tuple-accept-test.cpp @@ -69,19 +67,14 @@ namespace control { using std::make_tuple; - // - // _______________________________________________________________________________________________________________ - /** @internal mix in a function operator - * @todo variadic type-seq //////////////////////////////////////////////////////////////////////TICKET #987 : make lib::meta::Types variadic, then replace this by a single variadic template - */ + /** @internal mix in a function operator */ template< class TAR, class BA, class RET , typename TYPES > struct AcceptArgs ; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : this specialisation handles the variadic case and will be the only definition in future template - struct AcceptArgs > + struct AcceptArgs > : BA { RET @@ -92,201 +85,15 @@ namespace control { }; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisations become obsolete with the old-style type-sequence - /* specialisations for 0...9 Arguments.... */ - template< class TAR, class BA, class RET - > //____________________________________ - struct AcceptArgs > ///< Accept dummy binding (0 Arguments) - : BA - { - RET - operator() () - { - return static_cast (this) -> bindArg (std::tuple<>() ); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - > //_______________________________ - struct AcceptArgs > ///< Accept binding for 1 Argument - : BA - { - RET - operator() (T1 a1) - { - return static_cast (this) -> bindArg (make_tuple (a1)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 2 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 3 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2, T3 a3) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 4 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2, T3 a3, T4 a4) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 5 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 6 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - , typename T7 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 7 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6,a7)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - , typename T7 - , typename T8 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 8 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6,a7,a8)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - , typename T7 - , typename T8 - , typename T9 - > //________________________________ - struct AcceptArgs > ///< Accept binding for 9 Arguments - : BA - { - RET - operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6,a7,a8,a9)); - } - }; - - - - - - - // - // _______________________________________________________________________________________________________________ - /** @internal mix in a \c bind() function - * @todo variadic type-seq //////////////////////////////////////////////////////////////////////TICKET #987 : make lib::meta::Types variadic, then replace this by a single variadic template - */ + /** @internal mix in a \c bind() function */ template< class TAR, class BA, class RET , typename TYPES > struct AcceptBind ; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : this specialisation handles the variadic case and will be the only definition in future template - struct AcceptBind > + struct AcceptBind > : BA { RET @@ -297,191 +104,10 @@ namespace control { }; - ///////////////////////////////////////////////////////////////////////////////////TICKET #987 : the following specialisations become obsolete with the old-style type-sequence - /* specialisations for 0...9 Arguments.... */ - - template< class TAR, class BA, class RET - > //____________________________________ - struct AcceptBind > ///< Accept dummy binding (0 Arguments) - : BA - { - RET - bind () - { - return static_cast (this) -> bindArg (std::tuple<>() ); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - > //_______________________________ - struct AcceptBind > ///< Accept binding for 1 Argument - : BA - { - RET - bind (T1 a1) - { - return static_cast (this) -> bindArg (make_tuple (a1)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - > //________________________________ - struct AcceptBind > ///< Accept binding for 2 Arguments - : BA - { - RET - bind (T1 a1, T2 a2) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - > //________________________________ - struct AcceptBind > ///< Accept binding for 3 Arguments - : BA - { - RET - bind (T1 a1, T2 a2, T3 a3) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - > //________________________________ - struct AcceptBind > ///< Accept binding for 4 Arguments - : BA - { - RET - bind (T1 a1, T2 a2, T3 a3, T4 a4) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - > //________________________________ - struct AcceptBind > ///< Accept binding for 5 Arguments - : BA - { - RET - bind (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - > //________________________________ - struct AcceptBind > ///< Accept binding for 6 Arguments - : BA - { - RET - bind (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - , typename T7 - > //________________________________ - struct AcceptBind > ///< Accept binding for 7 Arguments - : BA - { - RET - bind (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6,a7)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - , typename T7 - , typename T8 - > //________________________________ - struct AcceptBind > ///< Accept binding for 8 Arguments - : BA - { - RET - bind (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6,a7,a8)); - } - }; - - - template< class TAR, class BA, class RET - , typename T1 - , typename T2 - , typename T3 - , typename T4 - , typename T5 - , typename T6 - , typename T7 - , typename T8 - , typename T9 - > //________________________________ - struct AcceptBind > ///< Accept binding for 9 Arguments - : BA - { - RET - bind (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) - { - return static_cast (this) -> bindArg (make_tuple (a1,a2,a3,a4,a5,a6,a7,a8,a9)); - } - }; - - - - // - // _______________________________________________________________________________________________________________ - /** @internal mix in complete set of templated \c bind() functions + /** @internal mix in complete set of templated `bind()` functions */ template< class TAR, class BA, class RET> struct AcceptAnyBind @@ -524,7 +150,7 @@ namespace control { template struct _Type > { - using Args = typename TyOLD::Seq; + using Args = typename Types::Seq; using Ret = void; using Sig = typename BuildFunType::Sig; using ArgTuple = std::tuple; diff --git a/src/steam/control/command-signature.hpp b/src/steam/control/command-signature.hpp index d1505ae12..b3cd3a180 100644 --- a/src/steam/control/command-signature.hpp +++ b/src/steam/control/command-signature.hpp @@ -59,7 +59,7 @@ namespace control { using lib::meta::BuildFunType; using lib::meta::_Fun; - using lib::meta::TySeq; + using lib::meta::Types; using lib::meta::Append; using lib::meta::PickLast; @@ -77,7 +77,7 @@ namespace control { using Args = typename _Fun::Args; using ArgList = typename Args::List; using ExtendedArglist = typename Append::List; - using ExtendedArgs = typename TySeq::Seq; + using ExtendedArgs = typename Types::Seq; public: using OperateSig = typename BuildFunType::Sig; @@ -118,7 +118,7 @@ namespace control { using Memento = RET; using ExtendedArglist = typename Append::List; - using ExtendedArgs = typename TySeq::Seq; + using ExtendedArgs = typename Types::Seq; using OperateSig = typename BuildFunType::Sig; using CaptureSig = typename BuildFunType::Sig; @@ -132,7 +132,7 @@ namespace control { using Memento = typename PickLast::Type; using OperationArglist = typename PickLast::List; - using OperationArgs = typename TySeq::Seq; + using OperationArgs = typename Types::Seq; using OperateSig = typename BuildFunType::Sig; using CaptureSig = typename BuildFunType::Sig; diff --git a/src/steam/control/command.hpp b/src/steam/control/command.hpp index af52eeb5a..759835b35 100644 --- a/src/steam/control/command.hpp +++ b/src/steam/control/command.hpp @@ -88,7 +88,7 @@ namespace control { using lib::Symbol; using std::shared_ptr; using lib::meta::Tuple; - using lib::meta::TySeq; + using lib::meta::Types; using FuncPtr = void*; diff --git a/src/steam/engine/feed-manifold.hpp b/src/steam/engine/feed-manifold.hpp index bc94f88f5..c3ca459cc 100644 --- a/src/steam/engine/feed-manifold.hpp +++ b/src/steam/engine/feed-manifold.hpp @@ -101,7 +101,7 @@ namespace engine { using lib::meta::forEachIDX; using lib::meta::ElmTypes; using lib::meta::Tagged; - using lib::meta::TySeq; + using lib::meta::Types; using lib::meta::Nil; using std::is_pointer; using std::is_reference; @@ -563,7 +563,7 @@ namespace engine { }; using ElmsI = typename _Proc::ElmsI; using ElmsO = typename _Proc::ElmsO; - using ElmsP = conditional_t<_Trait::hasParam(), typename _Proc::ArgP, TySeq<>>; + using ElmsP = conditional_t<_Trait::hasParam(), typename _Proc::ArgP, Types<>>; using Param = typename _Proc::SigP; ///////////////////////////////////////////////////////////////////OOO qualify? template class META> diff --git a/src/steam/mobject/builder/applicable-builder-target-types.hpp b/src/steam/mobject/builder/applicable-builder-target-types.hpp index c61261e7c..cb9464ab9 100644 --- a/src/steam/mobject/builder/applicable-builder-target-types.hpp +++ b/src/steam/mobject/builder/applicable-builder-target-types.hpp @@ -58,7 +58,7 @@ namespace steam { namespace mobject { namespace builder { - using BuilderTargetTypes = TySeq< session::Root + using BuilderTargetTypes = Types< session::Root , session::Clip , session::Effect , session::Binding diff --git a/src/steam/mobject/builder/buildertool.hpp b/src/steam/mobject/builder/buildertool.hpp index 410415e0b..148399e9f 100644 --- a/src/steam/mobject/builder/buildertool.hpp +++ b/src/steam/mobject/builder/buildertool.hpp @@ -159,7 +159,7 @@ namespace mobject { { } ; - using lib::meta::TySeq; // convenience for the users of "Applicable" + using lib::meta::Types; // convenience for the users of "Applicable" }// namespace mobject::builder diff --git a/src/steam/mobject/output-designation.hpp b/src/steam/mobject/output-designation.hpp index e12daa277..d70de5e52 100644 --- a/src/steam/mobject/output-designation.hpp +++ b/src/steam/mobject/output-designation.hpp @@ -113,7 +113,7 @@ namespace mobject { { VTABLE = sizeof(size_t) , SPEC_SIZ = VTABLE + mp::maxSize< - mp::TySeq< PID, lumiera_uid, uint>::List>() + mp::Types< PID, lumiera_uid, uint>::List>() }; typedef lib::OpaqueHolder SpecBuff; diff --git a/src/steam/mobject/session/session-impl.hpp b/src/steam/mobject/session/session-impl.hpp index 92f7504d4..3bc190ae7 100644 --- a/src/steam/mobject/session/session-impl.hpp +++ b/src/steam/mobject/session/session-impl.hpp @@ -268,7 +268,7 @@ namespace session { * to create "the session" instance and expose it through the * global Session PImpl */ - using SessionImplAPI = SessionServices< TySeq< SessionServiceFetch + using SessionImplAPI = SessionServices< Types< SessionServiceFetch , SessionServiceMutate , SessionServiceExploreScope , SessionServiceMockIndex diff --git a/src/steam/mobject/session/session-services.hpp b/src/steam/mobject/session/session-services.hpp index 471fff9be..7bb43f8e1 100644 --- a/src/steam/mobject/session/session-services.hpp +++ b/src/steam/mobject/session/session-services.hpp @@ -78,7 +78,7 @@ namespace mobject { namespace session { using lib::meta::InstantiateChained; - using lib::meta::TySeq; + using lib::meta::Types; /** diff --git a/tests/basics/time/format-support-test.cpp b/tests/basics/time/format-support-test.cpp index c7bbd31a9..a5b27b279 100644 --- a/tests/basics/time/format-support-test.cpp +++ b/tests/basics/time/format-support-test.cpp @@ -39,8 +39,8 @@ namespace test { run (Arg) { SupportStandardTimecode just_fine; - Supported just_smpte = Supported::formats< TySeq >(); - Supported just_simple = Supported::formats< TySeq >(); + Supported just_smpte = Supported::formats< Types >(); + Supported just_simple = Supported::formats< Types >(); Supported& support1 (just_fine); Supported& support2 (just_smpte); diff --git a/tests/basics/time/time-control-test.cpp b/tests/basics/time/time-control-test.cpp index 75ff63f31..67d1cad40 100644 --- a/tests/basics/time/time-control-test.cpp +++ b/tests/basics/time/time-control-test.cpp @@ -46,7 +46,7 @@ namespace test{ using lib::wrapper::ItemWrapper; using steam::asset::meta::TimeGrid; - using lib::meta::TySeq; + using lib::meta::Types; using lib::meta::InstantiateChainedCombinations; using LERR_(UNCONNECTED); @@ -475,8 +475,8 @@ namespace test{ void TimeControl_test::verifyMatrix_of_MutationCases (TimeValue const& origVal, TimeValue const& change) { - using KindsOfTarget = TySeq ; // time entities to receive value changes - using KindsOfSource = TySeq; // time entities to be used as change values + using KindsOfTarget = Types ; // time entities to receive value changes + using KindsOfSource = Types; // time entities to be used as change values using TestMatrix = InstantiateChainedCombinations< KindsOfTarget , KindsOfSource , TestCase // template to be instantiated for each type diff --git a/tests/basics/visitingtool-extended-test.cpp b/tests/basics/visitingtool-extended-test.cpp index 9d526e77f..25f1065df 100644 --- a/tests/basics/visitingtool-extended-test.cpp +++ b/tests/basics/visitingtool-extended-test.cpp @@ -64,8 +64,8 @@ namespace test2 { }; class Babbler - : public Applicable< Babbler, - TySeq::List, // treat this types + : public Applicable< Babbler, + Types::List, // treat this types VerboseVisitor // intermediary base class > { @@ -75,7 +75,7 @@ namespace test2 { }; // the classes above comprise the standard use case, - // what follows covers rather exotic corner cases + // what follows covers rather exotic corner cases @@ -86,7 +86,7 @@ namespace test2 { RET onUnknown (HomoSapiens&) { cout << "we-do-everything-for-YOU!\n"; return RET(); } }; - /** defines another different visiting tool base */ + /** defines another different visiting tool base */ typedef visitor::Tool Hastalavista; typedef Visitable Chief; ///< another special kind of visitable @@ -113,9 +113,9 @@ namespace test2 { * tailored for the Chief hierarchy */ class Blatherer - : public Applicable< Blatherer, - TySeq::List, // get calls to Visionary dispatched - VerboseVisitor // note: different tool base class + : public Applicable< Blatherer, + Types::List, // get calls to Visionary dispatched + VerboseVisitor // note: different tool base class > { public: @@ -123,8 +123,8 @@ namespace test2 { }; - - + + @@ -137,12 +137,13 @@ namespace test2 { */ class VisitingToolExtended_test : public Test { - virtual void run(Arg) + virtual void + run(Arg) { known_visitor_known_class(); visitor_not_visiting_some_class(); visiting_mixed_hierarchy(); - } + } void known_visitor_known_class() { @@ -193,7 +194,7 @@ namespace test2 { Babbler bab; Tool& tool1 (bab); cout << "=== Babbler masqueraded as Tool meets Leader and Visionary masqueraded as HomoSapiens ===\n"; - homo1.apply (tool1); // because just going through the VTable, the dispatch works as expected + homo1.apply (tool1); // because just going through the VTable, the dispatch works as expected homo2.apply (tool1); // same here (in both cases, the call is resolved to treat(Boss&) as expected) cout << "=== Babbler masqueraded as Tool meets Leader and Visionary masqueraded as Leader ===\n"; @@ -202,8 +203,8 @@ namespace test2 { // note: the following doesn't compile (an this is a feature, not a bug): - // "Chief chief" : is abstract, because the Visitable-Template enforces implementing - // the "apply(TOOL&)" function, either directly or via the + // "Chief chief" : is abstract, because the Visitable-Template enforces implementing + // the "apply(TOOL&)" function, either directly or via the // DEFINE_PROCESSABLE_BY macro } diff --git a/tests/basics/visitingtool-test.cpp b/tests/basics/visitingtool-test.cpp index 03a12d763..d84890c27 100644 --- a/tests/basics/visitingtool-test.cpp +++ b/tests/basics/visitingtool-test.cpp @@ -58,6 +58,7 @@ namespace test1 { class Leader : public Visionary { + /* can not be visited */ }; @@ -74,8 +75,8 @@ namespace test1 { class Babbler : public Applicable< Babbler - , TySeq::List // dispatch calls to this types - , VerboseVisitor + , Types::List // dispatch calls to this types + , VerboseVisitor // (base class / interface) > { public: @@ -83,9 +84,9 @@ namespace test1 { void treat (BigBoss&) { talk_to("Big Boss"); } }; - // note the following details: + // note the following fine points: // - Babbler "forgot" to declare being applicable to HomoSapiens - // - we have new derived class Leader without separate "apply()"-implementation + // - the class Leader hidden deep in the hierarchy is lacking an "apply()"-implementation @@ -95,7 +96,7 @@ namespace test1 { * Defines a hierarchy of test classes to check the following cases * - calling the correct visiting tool specialised function * for given concrete hierarchy classes - * - visiting tool not declaring to visit some class + * - visiting tool not declaring to visit some class * is silently ignored by default * - newly added classes will be handled by existing * functions according to inheritance relations @@ -103,7 +104,7 @@ namespace test1 { class VisitingTool_test : public Test { virtual void - run (Arg) + run (Arg) { known_visitor_known_class(); visiting_extended_hierarchy(); @@ -116,12 +117,12 @@ namespace test1 { BigBoss x2; // masquerade as HomoSapiens... - HomoSapiens& homo1 (x1); - HomoSapiens& homo2 (x2); + HomoSapiens& homo1{x1}; + HomoSapiens& homo2{x2}; cout << "=== Babbler meets Boss and BigBoss ===\n"; Babbler bab; - VisitingTool& vista (bab); + VisitingTool& vista{bab}; homo1.apply (vista); homo2.apply (vista); } @@ -141,7 +142,6 @@ namespace test1 { homo1.apply (vista); // silent error handler (not Applicable to HomoSapiens) homo2.apply (vista); // Leader handled as Visionary and treated as Boss } - }; diff --git a/tests/core/steam/control/command-clone-builder-test.cpp b/tests/core/steam/control/command-clone-builder-test.cpp index 71c89814d..9c355f63b 100644 --- a/tests/core/steam/control/command-clone-builder-test.cpp +++ b/tests/core/steam/control/command-clone-builder-test.cpp @@ -111,8 +111,7 @@ namespace test { void bindRandArgument (CommandImpl& cmd) { - using ArgType = TySeq; - TypedArguments> arg (std::make_tuple (rani (10000))); + TypedArguments> arg {std::make_tuple (rani (10000))}; cmd.setArguments (arg); CHECK (cmd.canExec()); } @@ -126,7 +125,7 @@ namespace test { void verifySeparation (PCmdImpl orig, PCmdImpl copy) { - CHECK (orig && copy); + CHECK (orig and copy); CHECK (orig->canExec()); CHECK (copy->canExec()); diff --git a/tests/core/steam/control/command-equality-test.cpp b/tests/core/steam/control/command-equality-test.cpp index 4c2e4ff41..b5d013663 100644 --- a/tests/core/steam/control/command-equality-test.cpp +++ b/tests/core/steam/control/command-equality-test.cpp @@ -79,7 +79,7 @@ namespace test { typedef function Fun_c; typedef function Fun_u; - using ArgTuple = Tuple>; + using ArgTuple = std::tuple; using ArgHolder = OpClosure; using MemHolder = MementoTie; using Closure = SimpleClosure; diff --git a/tests/core/steam/control/command-mutation-test.cpp b/tests/core/steam/control/command-mutation-test.cpp index a241c3e79..ac101ef01 100644 --- a/tests/core/steam/control/command-mutation-test.cpp +++ b/tests/core/steam/control/command-mutation-test.cpp @@ -107,7 +107,7 @@ namespace test { VERIFY_ERROR (UNBOUND_ARGUMENTS, functor(nullClosure) ); // now create a real closure.... - Tuple> param = std::make_tuple (23); + std::tuple param = std::make_tuple(23); SimpleClosure closed_over{param}; CmdClosure& closure (closed_over); @@ -154,7 +154,7 @@ namespace test { VERIFY_ERROR (UNBOUND_ARGUMENTS, undoFunctor(nullClosure) ); VERIFY_ERROR (UNBOUND_ARGUMENTS, undoFunctor.captureState(nullClosure) ); - Tuple> param; + Tuple> param; SimpleClosure clo{param}; CHECK (!mementoHolder); diff --git a/tests/core/steam/control/command-registry-test.cpp b/tests/core/steam/control/command-registry-test.cpp index eb65da2c3..189331e6a 100644 --- a/tests/core/steam/control/command-registry-test.cpp +++ b/tests/core/steam/control/command-registry-test.cpp @@ -190,7 +190,7 @@ namespace test { // when the CommandDef is complete, it issues the // allocation call to the registry behind the scenes.... - typedef shared_ptr PImpl; + using PImpl = shared_ptr; PImpl pImpl = registry.newCommandImpl(o_Fun,c_Fun,u_Fun); CHECK (1+cnt_inst == registry.instance_count()); @@ -210,8 +210,8 @@ namespace test { CHECK (!isSameObject (*pImpl, *clone)); CHECK (!pImpl->canExec()); - using ArgType = TySeq; - TypedArguments> arg{Tuple(98765)}; + using ArgTuple = std::tuple; + TypedArguments arg{ArgTuple{98765}}; pImpl->setArguments(arg); CHECK (pImpl->canExec()); diff --git a/tests/core/steam/control/handling-pattern-basics-test.cpp b/tests/core/steam/control/handling-pattern-basics-test.cpp index 4412f29ba..e2be87ac9 100644 --- a/tests/core/steam/control/handling-pattern-basics-test.cpp +++ b/tests/core/steam/control/handling-pattern-basics-test.cpp @@ -168,10 +168,10 @@ namespace test { CHECK (com); CHECK (not com->canExec()); - using ArgType = TySeq; + using ArgTuple = std::tuple; const int ARGR{1 + rani (1000)}; - Tuple tuple(ARGR); - TypedArguments> arg(tuple); + ArgTuple argTup{ARGR}; + TypedArguments arg{argTup}; com->setArguments(arg); CHECK (com->canExec()); diff --git a/tests/core/steam/mobject/builder/builder-tool-test.cpp b/tests/core/steam/mobject/builder/builder-tool-test.cpp index f4af38b3a..3df40ea74 100644 --- a/tests/core/steam/mobject/builder/builder-tool-test.cpp +++ b/tests/core/steam/mobject/builder/builder-tool-test.cpp @@ -41,7 +41,7 @@ namespace test { using session::Clip; using session::AbstractMO; using namespace mobject::test; - + using MediaAccessMock = lib::DependInject ::Local; @@ -49,7 +49,7 @@ namespace test { /** * BuilderTool implementation for checking the invocation of the correct - * \c treat() function and for accessing the original Placement from + * \c treat() function and for accessing the original Placement from * within this invocation. It is declared to be applicable to Clip * and DummyMO objects (wrapped into any acceptable shared-ptr). * Intentionally, we omit to declare it applicable to TestSubMO2 instances. @@ -58,14 +58,14 @@ namespace test { * which, due to this omission can't find a dispatcher entry when invoked, * so it will call the \c onUnknown(Buildable&) instead */ - class TestTool - : public Applicable::List> + class TestTool + : public Applicable::List> { public: string log_; - void treat (Clip& c) - { + void treat (Clip& c) + { Placement& pC = getPlacement(); cout << "Clip on media : "<< pC->getMedia() <<"\n"; CHECK (pC->operator==(c)); @@ -77,7 +77,7 @@ namespace test { log_ = string (getPlacement()); } void onUnknown (Buildable&) - { + { cout << "catch-all-function called...\n"; log_ = string (getPlacement()); } @@ -112,7 +112,7 @@ namespace test { TestTool t1; BuilderTool& tool = t1; - + Placement clip = asset::Media::create("test-1", asset::VIDEO)->createClip(); TestPlacement<> test1(*new TestSubMO1); TestPlacement<> test2(*new TestSubMO2); @@ -123,16 +123,16 @@ namespace test { INFO (test, "got Wrapper = %s", t1.log_.c_str()); CHECK (t1.log_ == string(clip)); - cout << "apply (tool, test1);\n"; + cout << "apply (tool, test1);\n"; apply (tool, test1); INFO (test, "got Wrapper = %s", t1.log_.c_str()); CHECK (t1.log_ == string(test1)); - cout << "apply (tool, test2);\n"; + cout << "apply (tool, test2);\n"; apply (tool, test2); INFO (test, "got Wrapper = %s", t1.log_.c_str()); CHECK (t1.log_ == string(test2)); - } + } }; diff --git a/tests/core/steam/mobject/session/session-service-access-test.cpp b/tests/core/steam/mobject/session/session-service-access-test.cpp index a2765dedd..b7adfd45e 100644 --- a/tests/core/steam/mobject/session/session-service-access-test.cpp +++ b/tests/core/steam/mobject/session/session-service-access-test.cpp @@ -41,7 +41,7 @@ namespace test { namespace { // what follows is a simulated (simplified) version // of the complete Session + SessionManager setup..... - using lib::meta::TySeq; + using lib::meta::Types; using lib::meta::InstantiateChained; @@ -161,7 +161,7 @@ namespace test { struct TSessManagerImpl; - using SessionImplAPI = TSessionServices< TySeq + using SessionImplAPI = TSessionServices< Types , TSessManagerImpl , TSessionImpl >; diff --git a/tests/library/meta/function-closure-test.cpp b/tests/library/meta/function-closure-test.cpp index 8a633071f..f477bb98a 100644 --- a/tests/library/meta/function-closure-test.cpp +++ b/tests/library/meta/function-closure-test.cpp @@ -46,8 +46,8 @@ namespace test { namespace { // test data - using List1 = TySeq, Num<2>, Num<3> >::List; - using List2 = TySeq, Num<6>, Num<7> >::List; + using List1 = Types, Num<2>, Num<3> >::List; + using List2 = Types, Num<6>, Num<7> >::List; /** special test fun @@ -140,10 +140,10 @@ namespace test { { cout << "\t:\n\t: ---Bind----\n"; - Tuple> tup0 ; - Tuple> tup1 (11); - Tuple> tup2 (11,12); - Tuple> tup3 (11,12,13); + Tuple> tup0 ; + Tuple> tup1 (11); + Tuple> tup2 (11,12); + Tuple> tup3 (11,12,13); DUMPVAL (tup0); DUMPVAL (tup1); DUMPVAL (tup2); @@ -167,10 +167,10 @@ namespace test { void check_bindFunc () { - Tuple> tup0 ; - Tuple> tup1 (11); - Tuple> tup2 (11,12); - Tuple> tup3 (11,12,13); + Tuple> tup0 ; + Tuple> tup1 (11); + Tuple> tup2 (11,12); + Tuple> tup3 (11,12,13); function unbound_functor0 (fun0); function unbound_functor1 (fun1); function unbound_functor2 (fun2); diff --git a/tests/library/meta/function-composition-test.cpp b/tests/library/meta/function-composition-test.cpp index 1477bc424..289f4fa71 100644 --- a/tests/library/meta/function-composition-test.cpp +++ b/tests/library/meta/function-composition-test.cpp @@ -198,7 +198,7 @@ namespace test { // Version2: extract the binding arguments from a tuple--- // - using PartialArg = Tuple, PH1, PH2>>; // Tuple type to hold the binding values. Note the placeholder types + using PartialArg = Tuple, PH1, PH2>>; // Tuple type to hold the binding values. Note the placeholder types PartialArg arg{num18, PH1(), PH2()}; // Value for partial application (the placeholders are default constructed) fun_23 = std::bind (f, get<0>(arg) // now extract the values to bind from this tuple @@ -219,7 +219,7 @@ namespace test { // Version3: let the PApply-template do the work for us--- // - using ArgTypes = TySeq>; // now package just the argument(s) to be applied into a tuple + using ArgTypes = Types>; // now package just the argument(s) to be applied into a tuple Tuple args_to_bind{Num<1>(18)}; fun_23 = PApply::bindFront (f , args_to_bind); @@ -281,7 +281,7 @@ namespace test { // covering the general case of partial function closure: typedef Num<5> Sig54321 (Num<5>, Num<4>, Num<3>, Num<2>, Num<1>); // Signature of the 5-argument function typedef Num<5> Sig54 (Num<5>, Num<4>); // ...closing the last 3 arguments should yield this 2-argument function - using Args2Close = TySeq, Num<2>, Num<1>>; // Tuple type to hold the 3 argument values used for the closure + using Args2Close = Types, Num<2>, Num<1>>; // Tuple type to hold the 3 argument values used for the closure // Close the trailing 3 arguments of the 5-argument function... function fun_54 = PApply::bindBack (fun15<5,4,3,2,1> diff --git a/tests/library/meta/generator-combinations-test.cpp b/tests/library/meta/generator-combinations-test.cpp index e63e3423c..528050168 100644 --- a/tests/library/meta/generator-combinations-test.cpp +++ b/tests/library/meta/generator-combinations-test.cpp @@ -35,11 +35,11 @@ namespace test { namespace { // test cases and data.... - typedef TySeq< Num<1> + typedef Types< Num<1> , Num<3> , Num<5> > Types1; - typedef TySeq< Num<2> + typedef Types< Num<2> , Num<4> , Num<6> > Types2; diff --git a/tests/library/meta/generator-test.cpp b/tests/library/meta/generator-test.cpp index 1896a160f..3c6511b1a 100644 --- a/tests/library/meta/generator-test.cpp +++ b/tests/library/meta/generator-test.cpp @@ -88,7 +88,7 @@ namespace test { using BASE::eat; // prevent shadowing }; - using TheTypes = TySeq< Block<1> + using TheTypes = Types< Block<1> , Block<2> , Block<3> , Block<5> diff --git a/tests/library/meta/meta-utils-test.cpp b/tests/library/meta/meta-utils-test.cpp index 1515259f0..b999db51f 100644 --- a/tests/library/meta/meta-utils-test.cpp +++ b/tests/library/meta/meta-utils-test.cpp @@ -203,7 +203,7 @@ namespace test { //-------------------------------------------------TEST-types-- - using TheList = TySeq + typedef Types< Num<1> , Num<3> , Num<5> > Types1; - typedef TySeq< Num<2> + typedef Types< Num<2> , Num<4> > Types2; - typedef TySeq< Num<7>> Types3; + typedef Types< Num<7>> Types3; @@ -132,7 +132,7 @@ namespace test { Prepend prep (22, 11,33,Num<5>()); CHECK (toString(prep) == "«tuple, Num<3>, Num<5> >»──(22,{11},{33},(5))"_expect); - using NulT = Tuple >; // plain-flat empty Tuple + using NulT = Tuple >; // plain-flat empty Tuple using NulL = Tuple; // list-style empty Tuple NulT nulT; // and these, too, can be instantiated diff --git a/tests/library/meta/tuple-record-init-test.cpp b/tests/library/meta/tuple-record-init-test.cpp index 64ffa64b3..3fe0ce694 100644 --- a/tests/library/meta/tuple-record-init-test.cpp +++ b/tests/library/meta/tuple-record-init-test.cpp @@ -31,7 +31,7 @@ using lib::idi::EntryID; using lib::diff::Rec; using lib::diff::MakeRec; using lib::diff::GenNode; -using lib::meta::TySeq; +using lib::meta::Types; using lib::meta::Tuple; using lib::meta::buildTuple; using lib::time::Duration; @@ -82,8 +82,8 @@ namespace test { void show_simpleUsage() { - using NiceTypes = TySeq; - using UgglyTypes = TySeq, Symbol, int, int64_t, double, Duration>; // various conversions and an immutable type (Duration) + using NiceTypes = Types; + using UgglyTypes = Types, Symbol, int, int64_t, double, Duration>; // various conversions and an immutable type (Duration) Rec args = MakeRec().scope("lalü", 42); Rec urgs = MakeRec().scope("lalü", "lala", 12, 34, 5.6, Time(7,8,9)); @@ -108,19 +108,19 @@ namespace test { { Rec args = MakeRec().scope("surprise", 42); - using TooMany = TySeq; + using TooMany = Types; VERIFY_ERROR (WRONG_TYPE, buildTuple (args)); // number of types in tuple exceeds capacity of the supplied argument record - using Unsigned = TySeq; - using Floating = TySeq; - using Narrowing = TySeq; + using Unsigned = Types; + using Floating = Types; + using Narrowing = Types; VERIFY_ERROR (WRONG_TYPE, buildTuple (args)); // dangerous conversion from signed to unsigned int is prohibited VERIFY_ERROR (WRONG_TYPE, buildTuple (args)); // conversion from integral to floating point element is prohibited VERIFY_ERROR (WRONG_TYPE, buildTuple (args)); // narrowing conversion from int to short is prohibited // yet other (non-numeric) conversions are still possible Rec timeArg = MakeRec().scope(Time(1,2,3,4)); - using TupStr = TySeq; + using TupStr = Types; Tuple tup = buildTuple (timeArg); CHECK (std::get (tup) == "4:03:02.001"); @@ -133,7 +133,7 @@ namespace test { VERIFY_ERROR (WRONG_TYPE, buildTuple (args)); VERIFY_ERROR (WRONG_TYPE, buildTuple (args)); - using ToSizeT = TySeq; + using ToSizeT = Types; VERIFY_ERROR (WRONG_TYPE, (buildTuple (args))); // not even conversion to size_t is allowed struct Hashy @@ -145,7 +145,7 @@ namespace test { { } }; - using WithHashy = TySeq; + using WithHashy = Types; Tuple tup2 = buildTuple (hashArg); // while any type explicitly constructible from LUID are permitted. VERIFY_ERROR (WRONG_TYPE, buildTuple (args)); // building a `Hashy` from int(42) is disallowed, of course diff --git a/tests/library/meta/typelist-manip-test.cpp b/tests/library/meta/typelist-manip-test.cpp index 64b92c1da..46b091e6f 100644 --- a/tests/library/meta/typelist-manip-test.cpp +++ b/tests/library/meta/typelist-manip-test.cpp @@ -45,11 +45,11 @@ namespace test { namespace { // type-lists to test with - using List1 = TySeq< Num<1> + using List1 = Types< Num<1> , Num<2> , Num<3> >::List; - using List2 = TySeq< Num<5> + using List2 = Types< Num<5> , Num<6> , Num<7> >::List; @@ -158,7 +158,7 @@ namespace test { using Elm = PickLast::Type; using Prefix = PickLast::List; - using ElmL = TySeq::List; + using ElmL = Types::List; EXPECT (Prefix, "-<1>-<2>-"); EXPECT (ElmL , "-<3>-" ); @@ -166,7 +166,7 @@ namespace test { using Elm1 = PickLast::Type; using NPrefix = PickLast::List; - EXPECT (TySeq, "-<3>-"); + EXPECT (Types, "-<3>-"); EXPECT (NPrefix , "-"); using NilSplit = PickLast::Type; @@ -204,16 +204,16 @@ namespace test { void verify_splice () { // various base lists - using BaLi1 = TySeq>::List; EXPECT (BaLi1, "-<1>-"); - using BaLi2 = TySeq,Num<2>>::List; EXPECT (BaLi2, "-<1>-<2>-"); - using BaLi3 = TySeq,Num<2>,Num<3>>::List; EXPECT (BaLi3, "-<1>-<2>-<3>-"); - using BaLi5 = TySeq,Num<2>,Num<3>,Num<4>,Num<5>>::List; + using BaLi1 = Types>::List; EXPECT (BaLi1, "-<1>-"); + using BaLi2 = Types,Num<2>>::List; EXPECT (BaLi2, "-<1>-<2>-"); + using BaLi3 = Types,Num<2>,Num<3>>::List; EXPECT (BaLi3, "-<1>-<2>-<3>-"); + using BaLi5 = Types,Num<2>,Num<3>,Num<4>,Num<5>>::List; EXPECT (BaLi5, "-<1>-<2>-<3>-<4>-<5>-"); // will "paste" those overlay lists "on top" the base typelists... - using OLi1 = TySeq>::List; EXPECT (OLi1, "-<9>-"); - using OLi2 = TySeq,Num<8>>::List; EXPECT (OLi2, "-<9>-<8>-"); - using OLi3 = TySeq,Num<8>,Num<7>>::List; EXPECT (OLi3, "-<9>-<8>-<7>-"); + using OLi1 = Types>::List; EXPECT (OLi1, "-<9>-"); + using OLi2 = Types,Num<8>>::List; EXPECT (OLi2, "-<9>-<8>-"); + using OLi3 = Types,Num<8>,Num<7>>::List; EXPECT (OLi3, "-<9>-<8>-<7>-"); /////////////////////////////////////////////////// @@ -472,7 +472,7 @@ namespace test { using Head = Dissect::Head; using End = Dissect::End; - using HeadEnd = TySeq; EXPECT (HeadEnd, "-<1>-<7>-"); + using HeadEnd = Types; EXPECT (HeadEnd, "-<1>-<7>-"); } @@ -538,7 +538,7 @@ namespace test { // Notably this can also be used to distribute into an already nested structure, // since the implementation is based on Append, which will actually concatenate lists // To demonstrate this, we first create a mixed list, where some elements are nested lists - using List_of_Lists = TySeq // ◁—————————————— this one is a regular element ,List2::List>::List; EXPECT (List_of_Lists, @@ -573,7 +573,7 @@ namespace test { "\n\t" "+---<11>-<2>-+" "\n\t" "+---<11>-<3>-+-"); - using Prefixes = TySeq,Num<22>,Num<33>>::List; + using Prefixes = Types,Num<22>,Num<33>>::List; using Dist2 = Distribute>; EXPECT (Dist2, "\n\t" "+---<11>-<0>-+" "\n\t" "+---<22>-<0>-+" @@ -590,7 +590,7 @@ namespace test { "\n\t" "+---<33>-<2>-+" "\n\t" "+---<33>-<3>-+-"); - using LioLi = TySeq::List; + using LioLi = Types::List; EXPECT (LioLi, "\n\t" "+---<1>-<2>-<3>-+" "\n\t" "+---<5>-<6>-<7>-+-"); using Dist4 = Distribute; diff --git a/tests/library/meta/typelist-test.cpp b/tests/library/meta/typelist-test.cpp index 905a176e9..8030e29d7 100644 --- a/tests/library/meta/typelist-test.cpp +++ b/tests/library/meta/typelist-test.cpp @@ -40,7 +40,7 @@ namespace test { }; - using SequenceOfTypes = TySeq< Block<21> + using SequenceOfTypes = Types< Block<21> , Block<13> , Block<8> , Block<5> diff --git a/tests/library/meta/typelist-util-test.cpp b/tests/library/meta/typelist-util-test.cpp index 46bfcfd8c..445f3135a 100644 --- a/tests/library/meta/typelist-util-test.cpp +++ b/tests/library/meta/typelist-util-test.cpp @@ -27,13 +27,13 @@ namespace test { - using TheList = TySeq< int + using TheList = Types< int , uint , int64_t , uint64_t >::List; - using EmptyList = TySeq< >::List; + using EmptyList = Types< >::List; diff --git a/tests/library/meta/typeseq-manip-test.cpp b/tests/library/meta/typeseq-manip-test.cpp index 6077b7349..c365a3d1c 100644 --- a/tests/library/meta/typeseq-manip-test.cpp +++ b/tests/library/meta/typeseq-manip-test.cpp @@ -43,14 +43,14 @@ namespace test { namespace { // type-sequences to test with - typedef TySeq< Num<1> - , Num<2> - , Num<3> - > Types1; - typedef TySeq< Num<7> - , Num<8> - , Num<9> - > Types2; + using Types1 = Types< Num<1> + , Num<2> + , Num<3> + >; + using Types2 = Types< Num<7> + , Num<8> + , Num<9> + >; } // (End) test data @@ -96,12 +96,12 @@ namespace test { using LL = Append::List; EXPECT (LL, "-<1>-<2>-<3>-<7>-<8>-<9>-"); - using Seq = TySeq::Seq; + using Seq = Types::Seq; using SeqList = Seq::List; EXPECT (Seq, "-<1>-<2>-<3>-<7>-<8>-<9>-"); EXPECT (SeqList, "-<1>-<2>-<3>-<7>-<8>-<9>-"); - using NulS = TySeq::Seq; + using NulS = Types::Seq; EXPECT (NulS, "-"); } @@ -111,8 +111,8 @@ namespace test { { using Prepend1 = Prepend, Types1 >; EXPECT (Prepend1, "-<5>-<1>-<2>-<3>-"); using Prepend2 = Prepend; EXPECT (Prepend2, "-<·>-<1>-<2>-<3>-"); - using Prepend3 = Prepend, TySeq<>>; EXPECT (Prepend3, "-<5>-"); - using Prepend4 = Prepend>; EXPECT (Prepend4, "-"); + using Prepend3 = Prepend, Types<>>; EXPECT (Prepend3, "-<5>-"); + using Prepend4 = Prepend>; EXPECT (Prepend4, "-"); } @@ -120,7 +120,7 @@ namespace test { check_shift () { using LL = Append::List; - using Seq = TySeq::Seq; + using Seq = Types::Seq; using Seq_0 = Shifted::Type; EXPECT (Seq_0, "-<7>-<8>-<9>-<1>-<2>-<3>-"); using Seq_1 = Shifted::Type; EXPECT (Seq_1, "-<8>-<9>-<1>-<2>-<3>-"); @@ -130,14 +130,14 @@ namespace test { using Seq_5 = Shifted::Type; EXPECT (Seq_5, "-<3>-"); using Seq_6 = Shifted::Type; EXPECT (Seq_6, "-"); - using Head_0 = TySeq::Head>; EXPECT (Head_0, "-<7>-"); - using Head_1 = TySeq::Head>; EXPECT (Head_1, "-<8>-"); - using Head_2 = TySeq::Head>; EXPECT (Head_2, "-<9>-"); - using Head_3 = TySeq::Head>; EXPECT (Head_3, "-<1>-"); - using Head_4 = TySeq::Head>; EXPECT (Head_4, "-<2>-"); - using Head_5 = TySeq::Head>; EXPECT (Head_5, "-<3>-"); - using Head_6 = TySeq::Head>; EXPECT (Head_6, "-" ); - using Head_7 = TySeq::Head>; EXPECT (Head_7, "-" ); + using Head_0 = Types::Head>; EXPECT (Head_0, "-<7>-"); + using Head_1 = Types::Head>; EXPECT (Head_1, "-<8>-"); + using Head_2 = Types::Head>; EXPECT (Head_2, "-<9>-"); + using Head_3 = Types::Head>; EXPECT (Head_3, "-<1>-"); + using Head_4 = Types::Head>; EXPECT (Head_4, "-<2>-"); + using Head_5 = Types::Head>; EXPECT (Head_5, "-<3>-"); + using Head_6 = Types::Head>; EXPECT (Head_6, "-" ); + using Head_7 = Types::Head>; EXPECT (Head_7, "-" ); } @@ -145,7 +145,7 @@ namespace test { check_split () { using LL = Append::List; - using Seq = TySeq::Seq; EXPECT (Seq , "-<1>-<2>-<3>-<7>-<8>-<9>-"); + using Seq = Types::Seq; EXPECT (Seq , "-<1>-<2>-<3>-<7>-<8>-<9>-"); using List = Split::List; EXPECT (List , "-<1>-<2>-<3>-<7>-<8>-<9>-"); using First = Split::First; EXPECT (First , "-<1>-" ); @@ -156,10 +156,10 @@ namespace test { using Head = Split::Head; using End = Split::End; - using Ends = TySeq; EXPECT (Ends , "-<1>-<9>-"); + using Ends = Types; EXPECT (Ends , "-<1>-<9>-"); - using NoList = Split>::List; EXPECT (NoList, "-"); - using NoHead = Split>::Head; EXPECT (NoHead, "-"); + using NoList = Split>::List; EXPECT (NoList, "-"); + using NoHead = Split>::Head; EXPECT (NoHead, "-"); } diff --git a/tests/library/meta/variadic-helper-test.cpp b/tests/library/meta/variadic-helper-test.cpp index e08908ad4..27e870c38 100644 --- a/tests/library/meta/variadic-helper-test.cpp +++ b/tests/library/meta/variadic-helper-test.cpp @@ -71,12 +71,12 @@ namespace test { using S1 = ElmTypes; CHECK (2 == S1::SIZ); CHECK (showType< S1 >() == "ElmTypes, void>"_expect); - CHECK (showType< S1::Seq >() == "TySeq"_expect); + CHECK (showType< S1::Seq >() == "Types"_expect); CHECK (showType< S1::Tup >() == "tuple"_expect); CHECK (showType< S1::Idx >() == "integer_sequence"_expect); using S1A = S1::Apply; - CHECK (showType< S1A >() == "TySeq, is_pointer >"_expect); + CHECK (showType< S1A >() == "Types, is_pointer >"_expect); using S1AR = ElmTypes::Rebind; CHECK (showType< S1AR >() == "__and_, is_pointer >"_expect); @@ -98,12 +98,12 @@ namespace test { using S0 = ElmTypes; CHECK (1 == S0::SIZ); CHECK (showType< S0 >() == "ElmTypes"_expect); - CHECK (showType< S0::Seq >() == "TySeq"_expect); + CHECK (showType< S0::Seq >() == "Types"_expect); CHECK (showType< S0::Tup >() == "tuple"_expect); CHECK (showType< S0::Idx >() == "integer_sequence"_expect); using S0A = S0::Apply; - CHECK (showType< S0A >() == "TySeq >"_expect); + CHECK (showType< S0A >() == "Types >"_expect); using S0AA = S0::AndAll; CHECK (showType< S0AA >() == "__and_ >"_expect); @@ -121,12 +121,12 @@ namespace test { using S2 = ElmTypes; CHECK (3 == S2::SIZ); CHECK (showType< S2 >() == "ElmTypes, void>"_expect); - CHECK (showType< S2::Seq >() == "TySeq"_expect); + CHECK (showType< S2::Seq >() == "Types"_expect); CHECK (showType< S2::Tup >() == "tuple"_expect); CHECK (showType< S2::Idx >() == "integer_sequence"_expect); using S2A = S2::Apply; - CHECK (showType< S2A >() == "TySeq, is_pointer, is_pointer >"_expect); + CHECK (showType< S2A >() == "Types, is_pointer, is_pointer >"_expect); using S2AA = S2::AndAll; CHECK (showType< S2AA >() == "__and_, is_pointer, is_pointer >"_expect); @@ -144,11 +144,11 @@ namespace test { using S3 = ElmTypes; CHECK (3 == S3::SIZ); CHECK (showType< S3 >() == "ElmTypes, void>"_expect); - CHECK (showType< S3::Seq >() == "TySeq"_expect); + CHECK (showType< S3::Seq >() == "Types"_expect); CHECK (showType< S3::Idx >() == "integer_sequence"_expect); using S3A = S3::Apply; - CHECK (showType< S3A >() == "TySeq, is_pointer, is_pointer >"_expect); + CHECK (showType< S3A >() == "Types, is_pointer, is_pointer >"_expect); using S3AA = S3::AndAll; CHECK (showType< S3AA >() == "__and_, is_pointer, is_pointer >"_expect); diff --git a/tests/library/variant-test.cpp b/tests/library/variant-test.cpp index f0ce113fa..f69fab78f 100644 --- a/tests/library/variant-test.cpp +++ b/tests/library/variant-test.cpp @@ -31,7 +31,7 @@ namespace lib { namespace test{ using ::Test; - using meta::TySeq; + using meta::Types; using lib::time::Time; using lib::time::TimeVar; @@ -43,7 +43,7 @@ namespace test{ // Test fixture... - using TestVariant = Variant>; + using TestVariant = Variant>; diff --git a/tests/vault/gear/activity-detector.hpp b/tests/vault/gear/activity-detector.hpp index e36fa97f9..49f77e4cf 100644 --- a/tests/vault/gear/activity-detector.hpp +++ b/tests/vault/gear/activity-detector.hpp @@ -292,10 +292,9 @@ namespace test { template struct _DiagnosticFun { - using Ret = typename lib::meta::_Fun::Ret; - using Args = typename lib::meta::_Fun::Args; - using ArgsX = typename lib::meta::StripNil::Seq; ////////////////////////////////////TICKET #987 : make lib::meta::Types variadic - using SigTypes = typename lib::meta::Prepend::Seq; + using Ret = typename lib::meta::_Fun::Ret; + using Args = typename lib::meta::_Fun::Args; + using SigTypes = typename lib::meta::Prepend::Seq; using Type = typename RebindVariadic::Type; }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 8fcc57810..ea0eb8897 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -85141,7 +85141,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -161972,7 +161972,8 @@ actively maintained upstream. Please remove gdl from Debian. - + + @@ -162757,8 +162758,8 @@ Since then others have made contributions, see the log for the history. - - + + @@ -162837,9 +162838,9 @@ Since then others have made contributions, see the log for the history. - + - + @@ -163099,7 +163100,7 @@ Since then others have made contributions, see the log for the history. - + @@ -163201,7 +163202,7 @@ Since then others have made contributions, see the log for the history. - + @@ -163807,7 +163808,7 @@ Since then others have made contributions, see the log for the history. - + @@ -163855,11 +163856,17 @@ Since then others have made contributions, see the log for the history. - - + + - + + + + + + + @@ -164234,10 +164241,10 @@ Since then others have made contributions, see the log for the history. - + - + @@ -164355,7 +164362,7 @@ Since then others have made contributions, see the log for the history. - + @@ -164392,8 +164399,8 @@ Since then others have made contributions, see the log for the history. - - + + @@ -164460,7 +164467,7 @@ Since then others have made contributions, see the log for the history. - + @@ -165424,33 +165431,50 @@ Since then others have made contributions, see the log for the history. - - - + + + - + - - - - + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -165519,7 +165543,7 @@ Since then others have made contributions, see the log for the history. - + @@ -165539,38 +165563,38 @@ Since then others have made contributions, see the log for the history. - + - - - - + + + + - - + + - + - - + + - - + + - + - - + + - - + + @@ -165587,8 +165611,14 @@ Since then others have made contributions, see the log for the history. + + - + + + + + @@ -165597,8 +165627,8 @@ Since then others have made contributions, see the log for the history. - - + +