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 9b85a23
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/checkpoint/container/list_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,35 @@ 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 = std::enable_if_t<
std::is_same<SerializerT, checkpoint::Footprinter>::value
>
>
inline void serialize(SerializerT& s, const std::__list_iterator<T>& iter) {
s.countBytes(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) {
s.countBytes(iter);
}
#endif

} /* end namespace checkpoint */

Expand Down

0 comments on commit 9b85a23

Please sign in to comment.