Skip to content

Commit

Permalink
#156: footprinting: dispatch::serializeArray
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Nov 20, 2020
1 parent 4d5368f commit cefaf9a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/checkpoint/container/vector_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,6 @@ void serialize(Serializer& s, std::vector<bool, VectorAllocator>& vec) {
}
}

template <
typename SerializerT,
typename T,
typename VectorAllocator,
typename = std::enable_if_t<
not SerializableTraits<T, SerializerT>::has_serialize_function and
not SerializableTraits<T, SerializerT>::is_bytecopyable
>
>
void serialize(SerializerT& s, std::vector<T, VectorAllocator>& vec) {
s.countBytes(vec);
s.addBytes(vec.capacity() * sizeof(T));
}

} /* end namespace checkpoint */

#endif /*INCLUDED_CHECKPOINT_CONTAINER_VECTOR_SERIALIZE_H*/
14 changes: 14 additions & 0 deletions src/checkpoint/dispatch/dispatch.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ inline void serializeArray(Serializer& s, T* array, SerialSizeType const len) {
}
}

template <
typename Serializer,
typename T,
typename = std::enable_if_t<
not std::is_same<
size_t,
decltype(checkpoint::getMemoryFootprint(std::declval<T>()))
>::value
>
>
inline void serializeArray(Serializer& s, T* array, SerialSizeType const len) {
Traverse::with<T, Serializer>(*array, s, len);
}

template <typename T>
buffer::ImplReturnType packBuffer(
T& target, SerialSizeType size, BufferObtainFnType fn
Expand Down

0 comments on commit cefaf9a

Please sign in to comment.