Home » Developing U++ » UppHub » Tree container - compile error when using Add() (error: call to implicitly-deleted copy constructor of 'Upp::Node<Upp::Element>)
Tree container - compile error when using Add() [message #55048] |
Tue, 06 October 2020 19:08 |
wimpie
Messages: 46 Registered: March 2013 Location: holland
|
Member |
|
|
I'm adding a few line in the TreeTest package, main.cpp :
<snip>
//Node<Element>
<snip>
ASSERT(ssa.IsEqual(sa));
Node<Element> test; // added
test.leaf.name = "add-test"; //
test.leaf.value = 12345; //
roota.Add(test); // to here
#if 1
<snip>
this looked simple enough, but gives the following error (clang) :
/home/tommie/Programming/ultimatepp/uppsrc/Core/Vcont.h:347:56: error: call to implicitly-deleted copy constructor of 'Upp::Node<Upp::Element>'
T& Add(const T& x) { T *q = new T(x); vector.Add(q); return *q; }
^ ~
/home/tommie/Programming/ultimatepp/bazaar/Tree/Tree.h:34:50: note: in instantiation of member function 'Upp::Array<Upp::Node<Upp::Element> >::Add' requested here
T& Add(const T& x) { T& t = B::Add(x); LinkChild(t); t.Relink(); return t; }
^
/home/tommie/Programming/ultimatepp/bazaar/TreeTest/main.cpp:44:8: note: in instantiation of member function 'Upp::Tree<Upp::Node<Upp::Element> >::Add' requested here
roota.Add(test); // to here
^
/home/tommie/Programming/ultimatepp/bazaar/Tree/Tree.h:151:4: note: copy constructor of 'Node<Upp::Element>' is implicitly deleted because base class 'Tree<Node<Upp::Element> >' has a deleted copy constructor
: public Tree<Node<T> >
^
/home/tommie/Programming/ultimatepp/bazaar/Tree/Tree.h:10:4: note: copy constructor of 'Tree<Upp::Node<Upp::Element> >' is implicitly deleted because base class 'Array<Upp::Node<Upp::Element> >' has a deleted copy constructor
: protected Array<T>, MoveableAndDeepCopyOption<Tree<T> >
^
/home/tommie/Programming/ultimatepp/uppsrc/Core/Vcont.h:437:2: note: copy constructor is implicitly deleted because 'Array<Upp::Node<Upp::Element> >' has a user-declared move constructor
Array(Array&& v) : vector(pick(v.vector)) {}
^
What am I doing wrong?
regards,
Willem
btw. GCC also gives an error, which is not captured in TheIde's error list (?!)
-
Attachment: main.cpp
(Size: 2.94KB, Downloaded 146 times)
|
|
|
Goto Forum:
Current Time: Sat May 04 13:38:59 CEST 2024
Total time taken to generate the page: 0.02551 seconds
|