From f8bb2faef4b272ed150eb3ca4cedaa79da410694 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 11 Mar 2009 15:09:17 +0200 Subject: Allow initialization of pod_seq and fix_seq from a C array Use this in the hybrid/binary/custom example. --- examples/cxx/hybrid/binary/custom/irawstream.txx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'examples/cxx/hybrid/binary/custom/irawstream.txx') diff --git a/examples/cxx/hybrid/binary/custom/irawstream.txx b/examples/cxx/hybrid/binary/custom/irawstream.txx index 2d4965e..b1bf757 100644 --- a/examples/cxx/hybrid/binary/custom/irawstream.txx +++ b/examples/cxx/hybrid/binary/custom/irawstream.txx @@ -15,12 +15,8 @@ operator>> (irawstream& s, xml_schema::pod_seq& x) x.clear (); if (n > 0) - { - x.reserve (n); - size_t mn = sizeof (T) * n; - memcpy (x.data_, s.align (sizeof (T), mn), mn); - x.size_ = n; - } + x.assign ( + reinterpret_cast (s.align (sizeof (T), sizeof (T) * n)), n); } template -- cgit v1.1