From 1fa7a4a43769e1bc0571d52f2c022409653ea745 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 3 Jul 2015 18:16:54 +0200 Subject: [PATCH] WIP: define the full set of default copy operations explicitly on a second thought, this "workaround" does not look so bad, due to the C++11 feature to request the default implementation explicitly. Maybe we'll never need a generic solution for these cases --- src/lib/diff/gen-node.hpp | 50 ++++++++++++++++----------------------- wiki/thinkPad.ichthyo.mm | 34 +++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/lib/diff/gen-node.hpp b/src/lib/diff/gen-node.hpp index 2f6f08aa7..6c5e81b49 100644 --- a/src/lib/diff/gen-node.hpp +++ b/src/lib/diff/gen-node.hpp @@ -121,33 +121,6 @@ namespace diff{ using std::string; - namespace {//////TODO this is a prototype, to be factored out - - template - struct ShaddowCopyCtor - { - operator bool() const { return true; } - }; - - template - struct ShaddowCopyCtor - { - // no bool conversion -> substitution fails. - }; - template - struct ShaddowCopyCtor - { - // no bool conversion -> substitution fails. - }; - template - struct ShaddowCopyCtor - { - // no bool conversion -> substitution fails. - }; - - }//(End) copy shaddowing solution - - class GenNode; using Rec = Record; @@ -173,11 +146,19 @@ namespace diff{ { public: template - DataCap(X&& x, bool = ShaddowCopyCtor()) + DataCap(X&& x) : Variant(std::forward(x)) { } ////////////////////////TICKET #963 Forwarding shadows copy operations -- generic solution?? + DataCap(DataCap const&) =default; + DataCap(DataCap&&) =default; + DataCap(DataCap& o) + : DataCap((DataCap const&)o) + { } + + DataCap& operator= (DataCap const&) =default; + DataCap& operator= (DataCap&&) =default; }; @@ -208,7 +189,7 @@ namespace diff{ template - GenNode(X&& val, bool = ShaddowCopyCtor()) + GenNode(X&& val) : idi(&val, buildChildID()) , data(std::forward(val)) { } @@ -227,7 +208,16 @@ namespace diff{ : GenNode(string(text)) { } - // default copy assignable + ////////////////////////TICKET #963 Forwarding shadows copy operations -- generic solution?? + GenNode(GenNode const&) =default; + GenNode(GenNode&&) =default; + GenNode(GenNode& o) + : GenNode((GenNode const&)o) + { } + + GenNode& operator= (GenNode const&) =default; + GenNode& operator= (GenNode&&) =default; + bool diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 8357203dc..0714b3e3a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -46,7 +46,39 @@ - + + + + + + + + + + + + + + +

+ ich hatte damals beim Variant und zugehörigen Buffer die Sorge, +

+

+ daß ich die Implikationen einer generischen Lösung nicht durchdringen kann. +

+

+ Und ich wollte keine Zeit auf einen exzessiven Unit-Test verwenden +

+ + +
+
+
+ + + + +