Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   passing data of an object to a function that takes a different object (http://www.go4expert.com/forums/passing-data-object-function-takes-t19481/)

aortizb 19Sep2009 11:20

passing data of an object to a function that takes a different object
 
Hello,

Let's assume I have a "Vec" class which is a wrapper of std::vector. The only private variable of "Vec" is just a std::vector object.

Let's assume that I have a function: void Vec:: foo(const Vec<double>& myVec).

Now, let's assume that I have an object vector<double> vec(100,3.5). Suppose that the entries of "vec" are exactly the entries I need in "myVec". Is there any way I can pass the entries of "vec" to "foo" without copying all its entries to an object of "Vec class"?

Thanks.


All times are GMT +5.5. The time now is 23:23.