Pothos  0.7.0-gf7fbae99
The Pothos dataflow programming software suite
Map.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
15 #include <Pothos/Archive/Pair.hpp>
16 #include <utility> //move
17 #include <map>
18 
19 namespace Pothos {
20 namespace serialization {
21 
22 template<typename Archive, typename K, typename T, typename Compare, typename Allocator>
23 void save(Archive &ar, const std::map<K, T, Compare, Allocator> &t, const unsigned int)
24 {
25  ar << unsigned(t.size());
26  for (const auto &pair : t)
27  {
28  ar << pair;
29  }
30 }
31 
32 template<typename Archive, typename K, typename T, typename Compare, typename Allocator>
33 void load(Archive &ar, std::map<K, T, Compare, Allocator> &t, const unsigned int)
34 {
35  t.clear();
36  unsigned size(0);
37  ar >> size;
38  for (size_t i = 0; i < size_t(size); i++)
39  {
40  std::pair<K, T> pair;
41  ar >> pair;
42  t.emplace(std::move(pair));
43  }
44 }
45 
46 template <typename Archive, typename K, typename T, typename Compare, typename Allocator>
47 void serialize(Archive &ar, std::map<K, T, Compare, Allocator> &t, const unsigned int ver)
48 {
50 }
51 
52 }}
Definition: ArchiveEntry.hpp:20
std::enable_if< Archive::isSave::value >::type invokeSplit(Archive &ar, T &value, const unsigned int ver)
Definition: Invoke.hpp:69
void save(Archive &ar, const std::complex< T > &t, const unsigned int)
Definition: Complex.hpp:20
void serialize(Archive &ar, std::complex< T > &t, const unsigned int ver)
Definition: Complex.hpp:37
void load(Archive &ar, std::complex< T > &t, const unsigned int)
Definition: Complex.hpp:27