From cb2a95627d8dc6a5d97c050a7e250f11f85bc96f Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 19 Mar 2016 17:09:16 +0100 Subject: [PATCH] WIP: specify first example binding... ...but does not compile, since all of the fallback functions will be instantiated, even while in fact we're overriding them right away with something that *can* be compiled. this prompts me to reconsider and question the basic approach with closures for binding, while in fact what I am doing here is to implement an ABC. --- src/lib/diff/tree-mutator-collection-binding.hpp | 4 ++-- .../diff/tree-manipulation-binding-test.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lib/diff/tree-mutator-collection-binding.hpp b/src/lib/diff/tree-mutator-collection-binding.hpp index 19c8d474a..03f7c5c79 100644 --- a/src/lib/diff/tree-mutator-collection-binding.hpp +++ b/src/lib/diff/tree-mutator-collection-binding.hpp @@ -403,13 +403,13 @@ static bool default_contentMatch (GenNode const& spec, Elm const& elm) { - //return spec.matches(elm); + return spec.matches(elm); } static Elm default_construct_from_payload (GenNode const& spec) { - //return spec.data.get(); + return spec.data.get(); } static bool diff --git a/tests/library/diff/tree-manipulation-binding-test.cpp b/tests/library/diff/tree-manipulation-binding-test.cpp index e38f604ab..268b154ed 100644 --- a/tests/library/diff/tree-manipulation-binding-test.cpp +++ b/tests/library/diff/tree-manipulation-binding-test.cpp @@ -298,7 +298,19 @@ namespace test{ // now set up a binding to these opaque private structures... auto mutator = TreeMutator::build() - .attach (collection(target)); + .attach (collection(target) + .constructFrom ([&](GenNode const& spec) -> Data + { + cout << "constructor invoked on "<