Here is my function:
const vector<int>& getVInt(){
vector<int> vint;
(...)
return vint;
}
And,
vector<int> x = getVInt();
returns:
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check
and
const vector<int>& x = getVInt();
returns nothing (a vector with a size different from 0 but with no value when I use x.at(i) ).
I looked for in forum but answers about temprorary and const ref doesn't help me to understand that.
Thank you.