// Copyright (c) 2007-2011 Hartmut Kaiser // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #if !defined(HPX_UTIL_SERIALIZE_SEQUENCE_MAY_17_2008_0545PM) #define HPX_UTIL_SERIALIZE_SEQUENCE_MAY_17_2008_0545PM #include #include #include #include #include #include #include namespace hpx { namespace util { template void serialize_sequence(Archive& ar, Sequence& seq); /// serialization support for a boost::fusion::sequence struct serialize_sequence_loop { template static void serialize(Archive& ar, Element& e, boost::mpl::false_) { ar & e; } template static void serialize(Archive& ar, unused_type& e, boost::mpl::false_) { } template static void serialize(Archive& ar, Element& e, boost::mpl::true_) { serialize_sequence(ar, e); } template static void serialize(Archive& ar, Element& e) { typedef typename boost::fusion::traits::is_sequence::type is_sequence; serialize(ar, e, is_sequence()); } template static void call (Archive&, First const&, Last const&, boost::mpl::true_) { } template static void call(Archive& ar, First const& first, Last const& last, boost::mpl::false_) { boost::fusion::result_of::equal_to< typename boost::fusion::result_of::next::type, Last > is_last; serialize(ar, *first); call(ar, boost::fusion::next(first), last, is_last); } template static void call(Archive& ar, First const& first, Last const& last) { boost::fusion::result_of::equal_to is_last; call(ar, first, last, is_last); } }; template inline void serialize_sequence(Archive& ar, Sequence& seq) { serialize_sequence_loop::call(ar, boost::fusion::begin(seq), boost::fusion::end(seq)); } }} #endif