MCPcopy Create free account
hub / github.com/bgrimstad/splinter / _serialize

Method _serialize

include/serializer.h:152–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150
151template <class T>
152void Serializer::_serialize(const T &obj)
153{
154 // This should really be used to avoid simply copying complex objects that are not trivially copyable
155 // std::is_trivially_copyable is shipped with GCC 5
156// static_assert(std::is_trivially_copyable<T>::value, "Missing Serializer::_serialize overload for T = "/* __PRETTY_FUNCTION__*/);
157
158 // Get a uint8_t pointer to the object, so we can copy it into the stream
159 auto objPtr = reinterpret_cast<const uint8_t *>(&obj);
160
161 std::copy(objPtr, objPtr + sizeof(T), write);
162
163 write += sizeof(T);
164}
165
166template <class T>
167void Serializer::deserialize(T &obj)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected