The code I referred is in the link -> http://upcoder.com/3/roll-your-own-vector In this example, in the copyrange method, they are using new operator like in the below code.
static void
copyRange(T* begin, T* end, T* dest)
{
while(begin != end)
{
new((void*)dest) T(*begin);
++begin;
++dest;
}
}
Can anyone explain how new() works in this context?
Aucun commentaire:
Enregistrer un commentaire