Found this code while doing code review:
std::array<uint, 10> expArray2 = {92,130,169,951,634,187,377,233,865,944};
copy(&expArray2[0], &expArray2[10], back_inserter(expected));
^~~~Is this Undefined behavior as ArrayIndexOutOfBoundAccess?
Is it same as (what I propose) :
std::copy ( expArray2, expArray2+10, expected.begin() );
My colleague says 1.) both are same 2.) there is no undefined behavior?
I explained to him that pointers and iterator are two different things, along with std::copy signature:
template <class InputIterator, class OutputIterator>
OutputIterator copy (InputIterator first, InputIterator last, OutputIterator result);
Could someone please confirm/explain this to me if I am wrong anywhere?