Containers with mixed types use value to represent arbitrary AMQP types.
| 112 | |
| 113 | // Containers with mixed types use value to represent arbitrary AMQP types. |
| 114 | static void mixed_containers() { |
| 115 | std::cout << std::endl << "== List and map of mixed type values." << std::endl; |
| 116 | proton::value v; |
| 117 | |
| 118 | std::vector<proton::value> l; |
| 119 | l.push_back(proton::value(42)); |
| 120 | l.push_back(proton::value(std::string("foo"))); |
| 121 | // By default, a sequence of proton::value is treated as an AMQP list. |
| 122 | v = l; |
| 123 | print(v); |
| 124 | std::vector<proton::value> l2 = proton::get<std::vector<proton::value> >(v); |
| 125 | std::cout << l2 << std::endl; |
| 126 | |
| 127 | std::map<proton::value, proton::value> m; |
| 128 | m[proton::value("five")] = proton::value(5); |
| 129 | m[proton::value(4)] = proton::value("four"); v = m; |
| 130 | print(v); |
| 131 | typedef std::map<proton::value, proton::value> value_map; |
| 132 | value_map m2(proton::get<value_map>(v)); |
| 133 | std::cout << m2 << std::endl; |
| 134 | } |
| 135 | |
| 136 | // Insert using stream operators (see print_next for example of extracting with stream ops.) |
| 137 | static void insert_stream_operators() { |