Apr 21, 2012 at 2:17pm Apr 21, 2012 at 2:17pm UTC
I want to return two arrays from a function. How can I achieve this?
Thank you~
Apr 21, 2012 at 3:05pm Apr 21, 2012 at 3:05pm UTC
I cannot understand the last two, can you explain them? thanks!
Apr 21, 2012 at 4:37pm Apr 21, 2012 at 4:37pm UTC
> I cannot understand the last two, can you explain them?
std::vector<int > bar( std::vector<double >& result2 ) ;
returns a vector<int> and sets the values in the vector<bouble> which is passed by reference.
In
void baz( std::vector<int >& result1, std::vector<double >& result2 ) ;
, both sequences are passed by reference.
See:
http://www.learncpp.com/cpp-tutorial/73-passing-arguments-by-reference/
Last edited on Apr 21, 2012 at 4:37pm Apr 21, 2012 at 4:37pm UTC
Apr 21, 2012 at 5:14pm Apr 21, 2012 at 5:14pm UTC
We could give a better answer if you were more specific about what you are trying to do, exactly. Can you post some code that demonstrates what you want? (The code doesn't have to work, obviously -- it just has to show us what you are trying to do.)