Passing two parameters: one by const ref. and another by ref.

Is it okay to pass two parameters to a function with one by constant referecne and the other by reference?

 
  void getUniqueIP(const vector<string>& refIP, vector<string>& refUniqueIP)
Yes.

Prefer 'reference to const T' over 'constant reference to T'.

Consider rewriting the function as:

std::vector<std::string> getUniqueIP( const std::vector<std::string>& refIP ) ;

See: http://joseluisestebanaparicio.blogspot.in/2010/06/want-speed-pass-by-value.html
Last edited on
Topic archived. No new replies allowed.