pupene  0.2.0
binary.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "binary-puppers.h"
4 #include "util.h"
5 
6 /** \file
7  * Utility functions for serializing to/from binary.
8  */
9 namespace pupene {
10  template <typename T>
11  T from_binary(std::istream& in, bool debug = false) {
12  T t;
13  do_pup(BinaryReader{in}, t, debug);
14  return t;
15  }
16 
17  template <typename T>
18  void to_binary(T& obj, std::ostream& out, bool debug = false) {
19  do_pup(BinaryWriter{out}, obj, debug);
20  }
21 }
Definition: debug.cpp:4
T from_binary(std::istream &in, bool debug=false)
Definition: binary.h:11
void to_binary(T &obj, std::ostream &out, bool debug=false)
Definition: binary.h:18
BinaryPupper(Stream &stream)