1 // Copyright (C) 2007 Matthias Troyer
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // This file contains helper data structures for use in transmitting
7 // properties. The basic idea is to optimize away any storage for the
8 // properties when no properties are specified.
9 #ifndef BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
10 #define BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
12 #include <boost/mpi/datatype.hpp>
13 #include <utility> // for std::pair
14 #include <boost/serialization/utility.hpp>
16 namespace boost { namespace parallel { namespace detail {
19 * This structure is like std::pair, with the only difference
20 * that tracking in the serialization library is turned off.
23 template<typename T, typename U>
24 struct untracked_pair : public std::pair<T,U>
28 untracked_pair(const T& t, const U& u)
29 : std::pair<T,U>(t,u) {}
31 template<class T1, class U1>
32 untracked_pair(std::pair<T1,U1> const& p)
33 : std::pair<T,U>(p) {}
36 template<typename T, typename U>
37 inline untracked_pair<T, U>
38 make_untracked_pair(const T& t, const U& u)
40 return untracked_pair<T,U>(t,u);
43 } } } // end namespace boost::parallel::detail
45 namespace boost { namespace mpi {
47 template<typename T, typename U>
48 struct is_mpi_datatype<boost::parallel::detail::untracked_pair<T, U> >
49 : is_mpi_datatype<std::pair<T,U> > {};
51 } } // end namespace boost::mpi
53 namespace boost { namespace serialization {
56 template<class Archive, class F, class S>
57 inline void serialize(
59 boost::parallel::detail::untracked_pair<F, S> & p,
60 const unsigned int /* file_version */
62 ar & boost::serialization::make_nvp("first", p.first);
63 ar & boost::serialization::make_nvp("second", p.second);
66 template<typename T, typename U>
67 struct is_bitwise_serializable<
68 boost::parallel::detail::untracked_pair<T, U> >
69 : is_bitwise_serializable<std::pair<T, U> > {};
71 template<typename T, typename U>
72 struct implementation_level<boost::parallel::detail::untracked_pair<T, U> >
73 : mpl::int_<object_serializable> {} ;
75 template<typename T, typename U>
76 struct tracking_level<boost::parallel::detail::untracked_pair<T, U> >
77 : mpl::int_<track_never> {} ;
79 } } // end namespace boost::serialization
81 #endif // BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP