| 135 | |
| 136 | template <class K, class T> |
| 137 | void map<K,T>::value(const proton::value& x) { |
| 138 | if (x.empty()) { |
| 139 | clear(); |
| 140 | } else { |
| 141 | std::unique_ptr<map_type> tmp(new map_type); |
| 142 | proton::get(x, *tmp); // Validate by decoding, may throw |
| 143 | map_.reset(tmp.release()); |
| 144 | value_.clear(); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | template <class K, class T> |
| 149 | proton::value& map<K,T>::value() { return flush(); } |