Sometimes I see function declare like this:
void foo(vector<some type>&& inputs);
What is the major reason to use && instead of &?
Sometimes I see function declare like this:
void foo(vector<some type>&& inputs);
What is the major reason to use && instead of &?
This is a new thing in C++11 called rvalue references.
You can read a great introduction to them here: http://thbecker.net/articles/rvalue_references/section_01.html
Essentially, it says it will be a reference to an object which can be destroyed without causing problems, and is used to optimise certain operations such as copy constructors (which can be changed for a swap if the other object can be destroyed).