The function GetIntArrayFromCharArray creates a copy, therefore your calls to begin() and end() refer to two different arrays! This is reflected literally in the error message - all you need to do is read and understand it. ;-)
[..]
(cut away revised parts of the solution - see below)
P.[...]S.:
[...]
Sorry, I need to revise my solution a third time:
It seems you are trying to append multiple converted int arrays in a loop: the first time you simply call
GetIntArrayFromCharArray
, and that's fine. Inthe following loop iterations, you convert the char array and try to append it to the existing int array.
As for the solution you're looking for, the first thing you need is a local variable to hold the converted int array, as pointed out above, and then you need append(), like this:
auto myIntArray = GetIntArrayFromCharArray(vec);
concatAry.append(myIntArray.begin(), myIntArray.end());
The copy() function can be used only for the purpose of copying data to a location that is already allocated. Your concatAry however is only large enough to hold it's existing elements, therefore you need to use append() instead. Alternately you could use resize() first, but why use two function calls when you can do it in one? ;-)