| 9 | namespace bh = boost::histogram; |
| 10 | |
| 11 | int main() { |
| 12 | auto a = bh::make_static_histogram(bh::axis::regular<>(3, -1, 1, "r"), |
| 13 | bh::axis::integer<>(0, 2, "i")); |
| 14 | a(0.5, 1); |
| 15 | |
| 16 | std::string buf; // holds persistent representation |
| 17 | |
| 18 | // store histogram |
| 19 | { |
| 20 | std::ostringstream os; |
| 21 | boost::archive::text_oarchive oa(os); |
| 22 | oa << a; |
| 23 | buf = os.str(); |
| 24 | } |
| 25 | |
| 26 | auto b = decltype(a)(); // create a default-constructed second histogram |
| 27 | |
| 28 | std::cout << "before restore " << (a == b) << std::endl; |
| 29 | // prints: before restore 0 |
| 30 | |
| 31 | // load histogram |
| 32 | { |
| 33 | std::istringstream is(buf); |
| 34 | boost::archive::text_iarchive ia(is); |
| 35 | ia >> b; |
| 36 | } |
| 37 | |
| 38 | std::cout << "after restore " << (a == b) << std::endl; |
| 39 | // prints: after restore 1 |
| 40 | } |
| 41 | |
| 42 | //] |
nothing calls this directly
no test coverage detected