Skip to content

Commit

Permalink
#156: footprinting: support std::list::iterator in libc++
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Nov 23, 2020
1 parent e91b3dd commit cc0f0d4
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/checkpoint/container/list_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,38 @@ inline void serialize(Serializer& s, std::deque<T>& lst) {
serializeOrderedContainer(s, lst);
}

// FIXME: 'typename std::list<T>::iterator' doesn't work here
//
// this depends on the (standard library) implementation details and
// doesn't work when libc++ is used
// last resort would be to use '#if defined(_LIBCPP_VERSION)))'

/**
* Note: 'typename std::list<T>::iterator' doesn't work here.
* This depends on the (standard library) implementation details and requires
* checking for '_LIBCPP_VERSION' for libc++ to work.
*/
#if defined(_LIBCPP_VERSION)
template <
typename SerializerT,
typename T,
typename VoidPtr,
typename = std::enable_if_t<
std::is_same<SerializerT, checkpoint::Footprinter>::value
>
>
inline void serialize(
SerializerT& s, const std::__list_iterator<T, VoidPtr>& iter
) {
#else
template <
typename SerializerT,
typename T,
typename = std::enable_if_t<
std::is_same<SerializerT, checkpoint::Footprinter>::value
>
>
inline void serialize(SerializerT& s, std::_List_iterator<T>& iter) {
inline void serialize(SerializerT& s, const std::_List_iterator<T>& iter) {
#endif
s.countBytes(iter);
}


} /* end namespace checkpoint */

#endif /*INCLUDED_CHECKPOINT_CONTAINER_LIST_SERIALIZE_H*/

0 comments on commit cc0f0d4

Please sign in to comment.