#include <vector>
#include <memory>
#include <algorithm>
#include <iostream>
 
int main()
{
  using namespace std;
 
  vector<size_t> v;
  v.push_back(1);
  v.push_back(2);
  v.push_back(3);
 
  unique_ptr<char[]> p( new char[v.size() * sizeof(size_t)] );
 
  // copy data from v into char array
  copy( reinterpret_cast<char *>(v.data()), 
        reinterpret_cast<char *>(v.data()) + v.size() * sizeof(size_t),
        p.get() );
 
  vector<size_t> w;
  w.resize(3);
 
  // copy data from char array into w
  copy( p.get(), p.get() + v.size() * sizeof(size_t), reinterpret_cast<char *>(w.data()) );
 
  for( size_t i = 0; i < w.size(); ++i ) {
    cout << w[i] << " ";
  }
}
