diff --git a/research/try.cpp b/research/try.cpp index 8371cc4f0..6a18af5c0 100644 --- a/research/try.cpp +++ b/research/try.cpp @@ -33,18 +33,11 @@ // 1/16 - build tuple from runtime-typed variant container // 3/17 - generic function signature traits, including support for Lambdas // 9/17 - manipulate variadic templates to treat varargs in several chunks +// 11/17 - metaprogramming to detect the presence of extension points /** @file try.cpp - ** Metaprogramming: manipulations on variadic template argument packs. - ** Investigation how to transform a parameter pack such as to forward a fixed chunk - ** to one sub-ctor and delegate the rest to a tail recursive call. - ** - ** This investigation was spurred by an attempt to create an inline storage layout - ** with possible heap-based extension. Being able to build such an object layout - ** would enable several possibly interesting optimisations when most usage scenarios - ** of a class will only use a small element count, while some usages still require - ** an essentially unlimited open number of elements. + ** Metaprogramming: how to detect that a type in question exposes a free function extension point. ** */ @@ -53,15 +46,13 @@ typedef unsigned int uint; #include "lib/format-cout.hpp" #include "lib/format-util.hpp" //#include "lib/meta/function.hpp" -#include "lib/meta/variadic-helper.hpp" #include "lib/test/test-helper.hpp" #include #include #include -#include -using lib::meta::_Fun; +//using lib::meta::_Fun; using lib::test::showSizeof; using std::function; @@ -76,11 +67,11 @@ using std::string; cout << "typeof( " << STRINGIFY(_TY_) << " )= " << lib::meta::typeStr<_TY_>() < -void -fun2 (ARGS... is) +int +fun1 (long) { - cout << "FUN-"<; - - -template -Arr -dispatch_ (IndexSeq,IndexSeq, ARGS...args) - { - Arr arr{pickInit (args...) ...}; - fun2 (pickArg (args...) ...); - return arr; - } - -template -Arr -dispatch (ARGS...args) - { - enum {SIZ = sizeof...(args)}; - - using First = typename BuildIndexSeq<3>::Ascending; - using Next = typename BuildIdxIter::template After<3>; - - return dispatch_ (First(),Next(), args...); - } +template()))> +struct Probe + { }; int main (int, char**) { - fun2 (1,2,3,4); - fun2 (5,6); + fun1 (23); fun2 (); - auto arr = dispatch (2,3,4,5,6,7,8); - cout << util::join(arr) << "| " << showSizeof(arr) < numz{1,-2,3,-5,8,-13}; auto ii = eachElm(numz); CHECK (!isnil (ii)); @@ -292,6 +295,7 @@ namespace test{ CHECK (materialise(ii) == "-2-3--5-8--13"); CHECK (materialise(jj) == "-3--5-8--13"); +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1117 } @@ -302,6 +306,8 @@ namespace test{ verify_mapOperation() { UNIMPLEMENTED("map function onto the results"); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1117 +#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1117 }