pointer to vector problem

ive created a vector of vector and initialized like this
vector<vector<double>*>* vec1= new vector<vector<double>*>;
for(size_t t =0 ;t<500 ;t++ )
vector<double>* v = new vector<double>;

now can i assign like this ??
vector<vector<double>*>* vec2 = vec2 ;
in my program it worked fine and when i rebuild im getting error ->

Error 33 error C2440: 'initializing' : cannot convert from 'std::vector<_Ty>' to 'std::vector<_Ty> '
May I ask why you are using pointers for this?
Do you really need a vector pointer of vector pointers? What are you trying to achieve?
yes i need pointers because values or not fixed it is more than 500
10000+ values need to be inserted
yes i need pointers because values or not fixed it is more than 500
Vector is dynamically sized so large and unknown amounts is not a problem.
10000+ values need to be inserted
Vector stores it values in heap, so it will be no problem with that too.
Read about reserve() method. It will help with perfomance.

now ive used pointer everywhere in my project and i dont want to modify that one but wanted to assign it some other
i want to assign this -> vector<vector<double>*>* vec1 to vector<vector<double>> is it possible ???
use the copy constructor.

std::vector<std::vector<double>* >* vec2(vec1);
i wanted to copy pointer values vector<vector<double>*>* vec1 to
vector<vector<double>> vec2
Oh I didn't even notice because your original code had pointers. Anyways why would you want to do that? Doesn't really make sense to me. The only way I can think of though is to iterate with something like:

for(const auto &it:vec1)
    for(const auto &it2:it)

There is probably other ways but I don't think any of them will be to pretty.
but in my project all vector pointers are used i dont know y
cant we use simple vectors for that
can u tell me diff between vector<vector<double>*>* and vector<vector<double>> in terms of memory and etc
One of them is a pointer to a container of containers full of pointers and the other is a container full of containers of objects. I would really only use pointers if the data types are large and not built-in types like doubles/ints/chars ect..

I think you should read up on pointers and STL containers before using them.

ok got it
i want to copy vector<vector<double>*>* vec1 from vector<vector<double>*>* vec2 and pass vector<vector<double>*>* vec1 to a function

and i need vec1 and vec2 to be present
ex : func(vector<vector<double>*>* , vector<string>);
Topic archived. No new replies allowed.