stlemitter.h
Go to the documentation of this file.
1 #ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
2 #define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
3 
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
7 
8 
9 #include <vector>
10 #include <list>
11 #include <set>
12 #include <map>
13 
14 namespace YAML_PM
15 {
16  template<typename Seq>
17  inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
18  emitter << BeginSeq;
19  for(typename Seq::const_iterator it=seq.begin();it!=seq.end();++it)
20  emitter << *it;
21  emitter << EndSeq;
22  return emitter;
23  }
24 
25  template<typename T>
26  inline Emitter& operator << (Emitter& emitter, const std::vector<T>& v) {
27  return EmitSeq(emitter, v);
28  }
29 
30  template<typename T>
31  inline Emitter& operator << (Emitter& emitter, const std::list<T>& v) {
32  return EmitSeq(emitter, v);
33  }
34 
35  template<typename T>
36  inline Emitter& operator << (Emitter& emitter, const std::set<T>& v) {
37  return EmitSeq(emitter, v);
38  }
39 
40  template <typename K, typename V>
41  inline Emitter& operator << (Emitter& emitter, const std::map<K, V>& m) {
42  typedef typename std::map <K, V> map;
43  emitter << BeginMap;
44  for(typename map::const_iterator it=m.begin();it!=m.end();++it)
45  emitter << Key << it->first << Value << it->second;
46  emitter << EndMap;
47  return emitter;
48  }
49 }
50 
51 #endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
Emitter & EmitSeq(Emitter &emitter, const Seq &seq)
Definition: stlemitter.h:17


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:03