Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:15

0001 // Copyright (C) 2007 Matthias Troyer
0002 //
0003 // Use, modification and distribution is subject to the Boost Software
0004 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //
0006 // This file contains helper data structures for use in transmitting
0007 // properties. The basic idea is to optimize away any storage for the
0008 // properties when no properties are specified.
0009 #ifndef BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
0010 #define BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
0011 
0012 #include <boost/mpi/datatype.hpp>
0013 #include <utility> // for std::pair
0014 #include <boost/serialization/utility.hpp>
0015 
0016 namespace boost { namespace parallel { namespace detail {
0017 
0018 /**
0019  * This structure is like std::pair, with the only difference
0020  * that tracking in the serialization library is turned off.
0021  */
0022  
0023 template<typename T, typename U>
0024 struct untracked_pair : public std::pair<T,U>
0025 {
0026   untracked_pair() {}
0027 
0028   untracked_pair(const T& t, const U& u)
0029   : std::pair<T,U>(t,u) {}
0030 
0031   template<class T1, class U1>
0032   untracked_pair(std::pair<T1,U1> const& p)
0033   : std::pair<T,U>(p) {}  
0034 };
0035 
0036 template<typename T, typename U>
0037 inline untracked_pair<T, U>
0038 make_untracked_pair(const T& t, const U& u)
0039 {
0040   return untracked_pair<T,U>(t,u);
0041 }
0042 
0043 } } } // end namespace boost::parallel::detail
0044 
0045 namespace boost { namespace mpi {
0046 
0047 template<typename T, typename U>
0048 struct is_mpi_datatype<boost::parallel::detail::untracked_pair<T, U> >
0049   : is_mpi_datatype<std::pair<T,U> > {};
0050 
0051 } } // end namespace boost::mpi
0052 
0053 namespace boost { namespace serialization {
0054 
0055 // pair
0056 template<class Archive, class F, class S>
0057 inline void serialize(
0058     Archive & ar,
0059     boost::parallel::detail::untracked_pair<F, S> & p,
0060     const unsigned int /* file_version */
0061 ){
0062     ar & boost::serialization::make_nvp("first", p.first);
0063     ar & boost::serialization::make_nvp("second", p.second);
0064 }
0065 
0066 template<typename T, typename U>
0067 struct is_bitwise_serializable<
0068         boost::parallel::detail::untracked_pair<T, U> >
0069   : is_bitwise_serializable<std::pair<T, U> > {};
0070 
0071 template<typename T, typename U>
0072 struct implementation_level<boost::parallel::detail::untracked_pair<T, U> >
0073  : mpl::int_<object_serializable> {} ;
0074 
0075 template<typename T, typename U>
0076 struct tracking_level<boost::parallel::detail::untracked_pair<T, U> >
0077  : mpl::int_<track_never> {} ;
0078 
0079 } } // end namespace boost::serialization
0080 
0081 #endif // BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP