| 214 | // Verifies the given data type is a POD and copies the bytes of each value |
| 215 | // in the vector into a newly created string. |
| 216 | template <typename T> inline string EncodeVectorPOD(const vector<T>& vec) { |
| 217 | ENFORCE_POD(T); |
| 218 | string s; |
| 219 | STLStringResizeUninitialized(&s, vec.size() * sizeof(T)); |
| 220 | typename vector<T>::const_iterator iter; |
| 221 | char* ptr; |
| 222 | for (iter = vec.begin(), ptr = string_as_array(&s); |
| 223 | iter != vec.end(); |
| 224 | ++iter, ptr += sizeof(T)) { |
| 225 | memcpy(ptr, &(*iter), sizeof(T)); |
| 226 | } |
| 227 | return s; |
| 228 | } |
| 229 | |
| 230 | // Reconstructs a vector of a plain old data type values from a C++ string. |
| 231 | // Verifies the given data type is a POD and copies the bytes of each value |
nothing calls this directly
no test coverage detected