add "remap" snippet using placement new

This commit is contained in:
Gael Guennebaud
2009-02-09 09:54:48 +00:00
parent 5b4c3b21f3
commit 666ade0c93
2 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
int data[] = {1,2,3,4,5,6,7,8,9};
Map<RowVectorXi> v(data,4);
cout << "The mapped vector v is: " << v << "\n";
new (&v) Map<RowVectorXi>(data+4,5);
cout << "Now v is: " << v << "\n";