DockAccess: solution how to bind partial application into generic lambda
...as it turned out, the result type was the problem: the lambda we provide typically does not yield an Allocator, but only its baseclass function<UICoord(UICoord)> solution: make Allocator a typedef, we don't expect any further functionality
This commit is contained in:
parent
5dea8eea1f
commit
90a5d76fc9
2 changed files with 14 additions and 16 deletions
|
|
@ -157,11 +157,7 @@ namespace interact {
|
||||||
* in creation or allocation of the view. The result of this invocation are the UI coordinates
|
* in creation or allocation of the view. The result of this invocation are the UI coordinates
|
||||||
* of an existing or newly created view.
|
* of an existing or newly created view.
|
||||||
*/
|
*/
|
||||||
class Allocator
|
using Allocator = std::function<UICoord(UICoord)>;
|
||||||
: public std::function<UICoord(UICoord)>
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -202,8 +198,8 @@ namespace interact {
|
||||||
// typedef Tuple<ArgTypeSeq> ArgTuple;
|
// typedef Tuple<ArgTypeSeq> ArgTuple;
|
||||||
// ArgTuple val(arg);
|
// ArgTuple val(arg);
|
||||||
// return PApply<SIG,ArgTypeSeq>::bindBack (f, val);
|
// return PApply<SIG,ArgTypeSeq>::bindBack (f, val);
|
||||||
/////////////////////////////////////////////////TODO looks like we need to *instantiate* the generic lambda before being able to bind it into a function
|
|
||||||
return [=](auto&&... args)
|
return [=](auto&&... args) -> Allocator
|
||||||
{
|
{
|
||||||
ArgTuple params {forward<decltype(args)> (args)...};
|
ArgTuple params {forward<decltype(args)> (args)...};
|
||||||
return PApply<FUN const&,FurtherArgs>::bindBack (fun, params);
|
return PApply<FUN const&,FurtherArgs>::bindBack (fun, params);
|
||||||
|
|
@ -213,10 +209,8 @@ namespace interact {
|
||||||
public:
|
public:
|
||||||
template<class FUN>
|
template<class FUN>
|
||||||
AllocSpec(FUN fun)
|
AllocSpec(FUN fun)
|
||||||
// : std::function<Allocator(ARGS&&...)> (buildPartialApplicator (forward<FUN> (fun)))
|
: std::function<Allocator(ARGS&&...)> (buildPartialApplicator (forward<FUN> (fun)))
|
||||||
{
|
{ }
|
||||||
UNIMPLEMENTED ("generate an allocator builder functor by partial function application");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}}// namespace gui::interact
|
}}// namespace gui::interact
|
||||||
|
|
|
||||||
|
|
@ -9157,10 +9157,10 @@
|
||||||
<node CREATED="1515726268721" ID="ID_243053845" MODIFIED="1515726329213" TEXT="welches intern PApply aufruft"/>
|
<node CREATED="1515726268721" ID="ID_243053845" MODIFIED="1515726329213" TEXT="welches intern PApply aufruft"/>
|
||||||
</node>
|
</node>
|
||||||
<node CREATED="1515732350136" ID="ID_1294398139" MODIFIED="1515732355403" TEXT="technisch....">
|
<node CREATED="1515732350136" ID="ID_1294398139" MODIFIED="1515732355403" TEXT="technisch....">
|
||||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1515732356319" ID="ID_1071937152" MODIFIED="1515732381516" TEXT="Problem generisches Lambda">
|
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1515732356319" ID="ID_1071937152" MODIFIED="1515798985447" TEXT="Problem: generisches Lambda in std::function binden">
|
||||||
<icon BUILTIN="broken-line"/>
|
<icon BUILTIN="broken-line"/>
|
||||||
</node>
|
</node>
|
||||||
<node CREATED="1515732383331" ID="ID_1688687565" MODIFIED="1515732413862">
|
<node CREATED="1515732383331" ID="ID_1688687565" MODIFIED="1515797049652">
|
||||||
<richcontent TYPE="NODE"><html>
|
<richcontent TYPE="NODE"><html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
|
|
@ -9172,11 +9172,15 @@
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
</richcontent>
|
</richcontent>
|
||||||
|
<icon BUILTIN="button_cancel"/>
|
||||||
|
</node>
|
||||||
|
<node CREATED="1515797030493" ID="ID_973074141" MODIFIED="1515799063868" TEXT="Nein: es ist wohl ehr der Rückgabetyp">
|
||||||
|
<icon BUILTIN="button_ok"/>
|
||||||
|
<node CREATED="1515798991747" ID="ID_1053457138" MODIFIED="1515799030345" TEXT="Allocator erbt nur von function"/>
|
||||||
|
<node CREATED="1515799031197" ID="ID_516020279" MODIFIED="1515799045183" TEXT="Lambda liefert aber nur UICoord(UICoord)"/>
|
||||||
|
<node CREATED="1515799046027" ID="ID_1437287913" MODIFIED="1515799056910" TEXT="Lösung: Allocator als reine Typedef">
|
||||||
<icon BUILTIN="idea"/>
|
<icon BUILTIN="idea"/>
|
||||||
</node>
|
</node>
|
||||||
<node CREATED="1515732415503" ID="ID_1684331001" MODIFIED="1515732424394" TEXT="...bevor wir es in std::function binden können"/>
|
|
||||||
<node CREATED="1515732427637" ID="ID_1533625561" MODIFIED="1515732445688" TEXT="Alternativ: old-style Binder konstruieren....?">
|
|
||||||
<icon BUILTIN="idea"/>
|
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue