aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-03-11 15:09:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-03-11 15:09:17 +0200
commitf8bb2faef4b272ed150eb3ca4cedaa79da410694 (patch)
treefff08a4d3ce6380709c84dc6b93d02de097dd7d5 /examples
parentda1ce0f39a36a2fca1f8d51a67b92be6368ddbfd (diff)
Allow initialization of pod_seq and fix_seq from a C array
Use this in the hybrid/binary/custom example.
Diffstat (limited to 'examples')
-rw-r--r--examples/cxx/hybrid/binary/custom/irawstream.txx8
1 files changed, 2 insertions, 6 deletions
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<T>& 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<const T*> (s.align (sizeof (T), sizeof (T) * n)), n);
}
template <typename T>