]> Dogcows Code - chaz/yoink/blob - src/stlplus/persistence/persistent_vector.tpp
need the configure script
[chaz/yoink] / src / stlplus / persistence / persistent_vector.tpp
1
2 ////////////////////////////////////////////////////////////////////////////////
3
4 // Author: Andy Rushton
5 // Copyright: (c) Southampton University 1999-2004
6 // (c) Andy Rushton 2004-2009
7 // License: BSD License, see ../docs/license.html
8
9 ////////////////////////////////////////////////////////////////////////////////
10 #include "persistent_int.hpp"
11
12 namespace stlplus
13 {
14
15 ////////////////////////////////////////////////////////////////////////////////
16
17 template<typename T, typename D>
18 void dump_vector(dump_context& context, const std::vector<T>& data, D dump_fn)
19 throw(persistent_dump_failed)
20 {
21 dump_unsigned(context,data.size());
22 for (unsigned i = 0; i < data.size(); i++)
23 dump_fn(context,data[i]);
24 }
25
26 template<typename T, typename R>
27 void restore_vector(restore_context& context, std::vector<T>& data, R restore_fn)
28 throw(persistent_restore_failed)
29 {
30 unsigned size = 0;
31 restore_unsigned(context,size);
32 data.resize(size);
33 for (unsigned i = 0; i < size; i++)
34 restore_fn(context,data[i]);
35 }
36
37 ////////////////////////////////////////////////////////////////////////////////
38
39 } // end namespace stlplus
This page took 0.03412 seconds and 4 git commands to generate.