framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fixed_container.hpp
Go to the documentation of this file.
1 // Copyright (C) 2012 iwg molw5
2 // For conditions of distribution and use, see copyright notice in COPYING
3 
13 #pragma once
14 
17 
18 namespace framework
19 {
20  namespace serializable
21  {
30  template <typename Value, typename Container>
31  struct fixed_container : public mutator_type <Container>
32  {
33  };
34 
42  template <
43  typename Value,
44  typename Container,
45  typename Input,
46  typename Output>
49  Input& in, Output& out)
50  {
51  Container result;
52  for (auto& x : result)
53  if (!dispatch_read <Value> (in, x))
54  return false;
55 
56  out = std::move(result);
57  return true;
58  }
59 
67  template <
68  typename Value,
69  typename Container,
70  typename Input,
71  typename Output>
74  Input const& in, Output& out)
75  {
76  for (auto const& x : in)
77  if (!dispatch_write <Value> (x, out))
78  return false;
79 
80  return true;
81  }
82  }
83 }