| 127 | template<typename T> |
| 128 | struct NativePODVectorHandler { |
| 129 | inline static void Write(Stream *strm, const std::vector<T> &vec) { |
| 130 | uint64_t sz = static_cast<uint64_t>(vec.size()); |
| 131 | strm->Write<uint64_t>(sz); |
| 132 | if (sz != 0) { |
| 133 | strm->Write(&vec[0], sizeof(T) * vec.size()); |
| 134 | } |
| 135 | } |
| 136 | inline static bool Read(Stream *strm, std::vector<T> *out_vec) { |
| 137 | uint64_t sz; |
| 138 | if (!strm->Read<uint64_t>(&sz)) return false; |