if u pass a std::vector by value to a function, does all of it's content get copyed?

thx

If a vector is passed by value, the data will be copied for use locally. If the vector is small, there is no problem, but if it is large, then the parameter-passing itself could consume a lot of resources. You should probably pass it by reference, and use the const keyword to ensure that the data doesn't get inadvertently modified.

if i pass vectors of vector by reference then internal vectors also get passed by reference?

eg function (vector<vector <int> > &a);

Reference to vector is like just "another name" for your original vector. You still work on memory taken by your original vector. So if you worry, that internal vector could be copied - you don't have to. It won't be copied.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.