mercredi 31 décembre 2014

Is there a way to initialize an array with a buffer at time of declaration?

Basically, I'm trying to do this:



char x[] = "hello";
char* y = new char[sizeof(x)](x); // won't work.


demo


Is there a way to do this cleanly? No comments on DO NOT USE raw arrays, or raw pointers please.


Aucun commentaire:

Enregistrer un commentaire