/// (De)serialize a vector.
template<typename T>
- struct _serializer<compat::vector<T>> {
+ struct _serializer<compat::vector<T>,
+ typename std::enable_if<
+ !std::is_scalar<T>::value>::type> {
static void
proc(compat::ostream &os, const compat::vector<T> &v) {
_proc<uint32_t>(os, v.size());
}
};
+ template<typename T>
+ struct _serializer<compat::vector<T>,
+ typename std::enable_if<
+ std::is_scalar<T>::value>::type> {
+ static void
+ proc(compat::ostream &os, const compat::vector<T> &v) {
+ _proc<uint32_t>(os, v.size());
+ os.write(reinterpret_cast<const char *>(v.begin()),
+ v.size() * sizeof(T));
+ }
+
+ static void
+ proc(compat::istream &is, compat::vector<T> &v) {
+ v.reserve(_proc<uint32_t>(is));
+ is.read(reinterpret_cast<char *>(v.begin()),
+ v.size() * sizeof(T));
+ }
+ };
+
/// (De)serialize a module::section.
template<>
struct _serializer<module::section> {