| 48 | |
| 49 | template <class T> |
| 50 | inline void SerializeMem(bool bRead, TVector<char>* data, T& c, bool stableOutput = false) { |
| 51 | if (IBinSaver::HasNonTrivialSerializer<T>(0u)) { |
| 52 | TMemoryStream f(data); |
| 53 | { |
| 54 | IBinSaver bs(f, bRead, stableOutput); |
| 55 | bs.Add(1, &c); |
| 56 | } |
| 57 | } else { |
| 58 | if (bRead) { |
| 59 | Y_ASSERT(data->size() == sizeof(T)); |
| 60 | c = *reinterpret_cast<T*>(&(*data)[0]); |
| 61 | } else { |
| 62 | data->yresize(sizeof(T)); |
| 63 | *reinterpret_cast<T*>(&(*data)[0]) = c; |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | //////////////////////////////////////////////////////////////////////////// |
| 69 | class THugeMemoryStream: public IBinaryStream { |