UI-Coordinates: integrate the initialisation split
...as developed in during the metaprogramming investigation
This commit is contained in:
parent
a839cac02b
commit
9378badf6b
2 changed files with 90 additions and 20 deletions
|
|
@ -49,10 +49,12 @@
|
|||
#include "lib/error.hpp"
|
||||
#include "lib/symbol.hpp"
|
||||
#include "lib/iter-adapter.hpp"
|
||||
#include "lib/meta/variadic-helper.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
//#include <boost/noncopyable.hpp>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <array>
|
||||
|
|
@ -61,6 +63,7 @@
|
|||
namespace lib {
|
||||
|
||||
// using std::unique_ptr;
|
||||
using std::forward;
|
||||
using std::string;
|
||||
using lib::Literal;
|
||||
using util::unConst;
|
||||
|
|
@ -88,6 +91,7 @@ namespace lib {
|
|||
return reinterpret_cast<size_t&> (p[0]);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Extension()
|
||||
: storage_{nullptr}
|
||||
|
|
@ -99,7 +103,8 @@ namespace lib {
|
|||
: storage_{new const char* [1 + sizeof...(ELMS)]}
|
||||
{
|
||||
size(storage_) = sizeof...(ELMS);
|
||||
storage_[1] = {elms...};
|
||||
std::initializer_list<const char*> lit{elms...};
|
||||
std::copy (begin(lit),end(lit), storage_+1);
|
||||
}
|
||||
|
||||
~Extension()
|
||||
|
|
@ -161,6 +166,10 @@ namespace lib {
|
|||
|
||||
|
||||
|
||||
using meta::pickArg;
|
||||
using meta::pickInit;
|
||||
using meta::IndexSeq;
|
||||
|
||||
/**
|
||||
* Abstraction for path-like topological coordinates.
|
||||
* A sequence of Literal strings, with array-like access and
|
||||
|
|
@ -170,31 +179,59 @@ namespace lib {
|
|||
template<size_t chunk_size>
|
||||
class PathArray
|
||||
{
|
||||
using LiteralArray = std::array<const char*, chunk_size>;
|
||||
using Lit = const char*;
|
||||
using LiteralArray = std::array<Lit, chunk_size>;
|
||||
|
||||
LiteralArray elms_;
|
||||
con::Extension tail_;
|
||||
|
||||
/**
|
||||
* @internal delegate ctor to place the initialiser arguments appropriately
|
||||
* @remarks the two index sequences passed by pattern match determine which
|
||||
* arguments go to the inline array, and which go to heap allocated extension.
|
||||
* The inline array has fixed size an is thus filled with trailing `NULL` ptrs,
|
||||
* which is achieved with the help of meta::pickInit(). The con::Extension
|
||||
* is an embedded smart-ptr, which, when receiving additional tail arguments,
|
||||
* will place and manage them within a heap allocated array.
|
||||
*/
|
||||
template<size_t...prefix, size_t...rest, typename...ARGS>
|
||||
PathArray (IndexSeq<prefix...>
|
||||
,IndexSeq<rest...>
|
||||
,ARGS&& ...args)
|
||||
: elms_{pickInit<prefix,Lit> (forward<ARGS>(args)...) ...}
|
||||
, tail_{pickArg<rest> (forward<ARGS>(args)...) ...}
|
||||
{
|
||||
this->normalise();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal rebinding helper for building sequences of index numbers,
|
||||
* to route the initialiser arguments into the corresponding storage
|
||||
* - the leading (`chunk_size`) arguments go into the LiteralArray inline
|
||||
* - all the remaining arguments go into heap allocated extension storage
|
||||
*/
|
||||
template<typename...ARGS>
|
||||
struct Split
|
||||
{
|
||||
using Prefix = typename meta::BuildIndexSeq<chunk_size>::Ascending;
|
||||
using Rest = typename meta::BuildIdxIter<ARGS...>::template After<chunk_size>;
|
||||
};
|
||||
|
||||
public:
|
||||
template<typename...ARGS>
|
||||
explicit
|
||||
PathArray (ARGS&& ...args)
|
||||
: elms_{}
|
||||
{
|
||||
UNIMPLEMENTED ("initialise path array components");
|
||||
}
|
||||
: PathArray(typename Split<ARGS...>::Prefix()
|
||||
,typename Split<ARGS...>::Rest()
|
||||
,forward<ARGS> (args)...)
|
||||
{ }
|
||||
|
||||
PathArray (PathArray const& o)
|
||||
: elms_(o.elms_)
|
||||
{
|
||||
UNIMPLEMENTED ("copy construct path array components");
|
||||
}
|
||||
|
||||
PathArray&
|
||||
operator= (PathArray const& r)
|
||||
{
|
||||
UNIMPLEMENTED ("path array copy assignment");
|
||||
}
|
||||
PathArray(PathArray&&) = default;
|
||||
PathArray(PathArray const&) = default;
|
||||
PathArray(PathArray& o) : PathArray((PathArray const&)o) { }
|
||||
PathArray& operator= (PathArray const&) = default;
|
||||
PathArray& operator= (PathArray &&) = default;
|
||||
////////////////////////TICKET #963 Forwarding shadows copy operations
|
||||
|
||||
|
||||
size_t
|
||||
|
|
@ -258,6 +295,12 @@ namespace lib {
|
|||
{
|
||||
UNIMPLEMENTED ("path implementation storage");
|
||||
}
|
||||
|
||||
void
|
||||
normalise()
|
||||
{
|
||||
UNIMPLEMENTED ("establish invariant");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3837,11 +3837,13 @@
|
|||
</node>
|
||||
<node CREATED="1506301421612" ID="ID_572376877" MODIFIED="1506301426568" TEXT="Meta-Problem">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1506301428698" ID="ID_1290675306" MODIFIED="1506301433910" TEXT="Parameter-Pack zerlegen">
|
||||
<node CREATED="1506301428698" ID="ID_1290675306" MODIFIED="1506723726199" TEXT="Parameter-Pack zerlegen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1506301435826" ID="ID_1852582857" MODIFIED="1506301447508" TEXT="ersten Teil in ein std::array"/>
|
||||
<node CREATED="1506301448288" ID="ID_1083459556" MODIFIED="1506301457058" TEXT="zweiten Teil rekursiv..."/>
|
||||
</node>
|
||||
<node CREATED="1506301468830" ID="ID_291609200" MODIFIED="1506301471937" TEXT="Lösungen">
|
||||
<node CREATED="1506301468830" FOLDED="true" ID="ID_291609200" MODIFIED="1506723813858" TEXT="Lösungen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1506301476836" ID="ID_1339982909" MODIFIED="1506302323712" TEXT="Stackoverflow">
|
||||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1506301629128" ID="ID_1265747852" LINK="https://stackoverflow.com/questions/14261183/how-to-make-generic-computations-over-heterogeneous-argument-packs-of-a-variadic" MODIFIED="1506301640408" TEXT="Param-Pack-Library"/>
|
||||
|
|
@ -3870,7 +3872,32 @@
|
|||
<node CREATED="1506301797721" ID="ID_1580459971" MODIFIED="1506301801941" TEXT="generell undurchsichtig"/>
|
||||
<node CREATED="1506301802865" ID="ID_1127036077" MODIFIED="1506301816915" TEXT="erfordert hohes Abstraktionsniveau"/>
|
||||
</node>
|
||||
<node CREATED="1506301834493" ID="ID_52512330" MODIFIED="1506301846055" TEXT="selber schreiben anhand Beispiel"/>
|
||||
<node COLOR="#338800" CREATED="1506301834493" ID="ID_52512330" MODIFIED="1506723706338" TEXT="selber schreiben anhand Beispiel">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1506723689710" ID="ID_454128552" MODIFIED="1506723762301" TEXT="Mini-Framework">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1506723694704" ID="ID_649123940" MODIFIED="1506723759877" TEXT="meta::pickArg">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1506723699774" ID="ID_748812841" MODIFIED="1506723757331" TEXT="meta::pickInit">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1506723746120" ID="ID_154958112" MODIFIED="1506723790105" TEXT="unit-test dazu">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
VariadicArgumentPicker_test
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue