I have created two arrays List1 and List2 with new in C++. List1 is updated with data. I would like to copy List1 to List2. I tried using
std::copy(std::begin(List1), std::end(List1), std::begin(List2));
However, this does not work and gives the following error message:
error: ‘begin’ is not a member of ‘std’
Any possible suggestions for this error? Or alternative ways to copy in C++?
"I have created two arrays List1 and List2 with new in C++"
The begin and end free functions won't work on a pointer.
Even if everything is correct, you may end up with no matching call to begin(T *&)
T is the type of your pointer.
Use std::vector or std::list other STL container or just simply static arrays to work with std::begin and std::end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With