Home » Community » Newbie corner » [Solved]Vector<Vector<int>> problem
Re: Vector<Vector<int>> problem [message #53062 is a reply to message #53045] |
Tue, 18 February 2020 18:43   |
Novo
Messages: 1430 Registered: December 2006
|
Ultimate Contributor |
|
|
bozero wrote on Sun, 16 February 2020 23:21
The code is working on upp-mingw-11873,
This code is not supposed to compile with any compiler and latest version of Upp.
There are two issues with this code.
1. You are supposed to tell explicitly what you want to do with your Vector.
vvi.Add(clone(vi1));
vvi.Add(pick(vi2));
In the first case you are making a copy, in second - moving.
2. There is a problem with Vector& operator<<(const T& x)
It is supposed to look like below. This version of operator<< is missing.
Vector& operator<<(T&& x) { Add(pick(x)); return *this; }
In this case you would be able to write
vvi << pick(vi1) << pick(vi2);
Hope this helps.
Regards,
Novo
|
|
|
Goto Forum:
Current Time: Fri Aug 01 15:18:13 CEST 2025
Total time taken to generate the page: 0.08376 seconds
|