Home » U++ Library support » U++ Core » Problem with copy construction of std::vector from Upp::Vector
Problem with copy construction of std::vector from Upp::Vector [message #43818] |
Tue, 28 October 2014 15:32 |
masu
Messages: 378 Registered: February 2006
|
Senior Member |
|
|
Hi,
when trying to copy construct std::vector from Upp::Vector like this:
Vector<int> v;
v << 1 << 2 << 3;
std::vector<int> std_v(v);
I get the following error:
error: invalid user-defined conversion from 'Upp::Vector<int>' to 'std::vector<int>::size_type {aka
long long unsigned int}' [-fpermissive]
std::vector constructor using iterators works well with Upp::Vector:
std::vector<int> siv(v.Begin(), v.End());
[EDIT]
Ok, the compiler takes another constructor with size_type argument since Upp::Vector is not a std::vector and therefore the copy constructor cannot be used.
It seems the easiest to use the std::vector constructor using iterators when one wants to copy an Upp::Vector to a std::vector or is there a simpler way of doing this?
Regards
Matthias
931b81e7ea53320dccc37375b34b38c3
[Updated on: Tue, 28 October 2014 18:33] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 07:14:25 CEST 2024
Total time taken to generate the page: 0.04232 seconds
|