std::vector<> as function parameter

Is it a good practice to use vector<double> as function parameter instead of double*? Or as a return type of function?
Yes. You'll probably want to pass it by reference though.
with the vector you'll have a lot more flexibility and be less prone to exceptions within the function because of vector's member functions
There is no such practice. If you need as a parameter a double you declare it double,. If you need as a parameter a vector of doubles (more often a reference to a vector of doubles) you declare it as a vector of doubles.
If you need as parameters a range of iterators of a vector you declare iterators as parameters.
Basically what everyone is saying: If you want to use a sequence of doubles, pass a vector by reference as you will have less problems, but if you only want a single value pass only that value, either by reference or not.
Topic archived. No new replies allowed.