I'm a novice with C++ and am wondering why std::sort()
directly changes the array. I would naturally think that the sort()
function should be like this:
anyVector = sort(anyVector.begin(), anyVector.end());
My question is: how std::sort()
understands that it must change the order of the array content if you don't mention the array itself to be re-assigned?
I know that it could appear as a trivial question, but I didn't find any explanation (maybe because it's obvious for many).