Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:44

0001 #ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0002 #define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0003 
0004 #if defined(_MSC_VER) ||                                            \
0005     (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
0006      (__GNUC__ >= 4))  // GCC supports "pragma once" correctly since 3.4
0007 #pragma once
0008 #endif
0009 
0010 #include <vector>
0011 #include <list>
0012 #include <set>
0013 #include <map>
0014 
0015 namespace YAML {
0016 template <typename Seq>
0017 inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
0018   emitter << BeginSeq;
0019   for (const auto& v : seq)
0020     emitter << v;
0021   emitter << EndSeq;
0022   return emitter;
0023 }
0024 
0025 template <typename T>
0026 inline Emitter& operator<<(Emitter& emitter, const std::vector<T>& v) {
0027   return EmitSeq(emitter, v);
0028 }
0029 
0030 template <typename T>
0031 inline Emitter& operator<<(Emitter& emitter, const std::list<T>& v) {
0032   return EmitSeq(emitter, v);
0033 }
0034 
0035 template <typename T>
0036 inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) {
0037   return EmitSeq(emitter, v);
0038 }
0039 
0040 template <typename K, typename V>
0041 inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
0042   emitter << BeginMap;
0043   for (const auto& v : m)
0044     emitter << Key << v.first << Value << v.second;
0045   emitter << EndMap;
0046   return emitter;
0047 }
0048 }
0049 
0050 #endif  // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66