summaryrefslogtreecommitdiff
path: root/boost/property_map/parallel/detail/untracked_pair.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/property_map/parallel/detail/untracked_pair.hpp')
-rw-r--r--boost/property_map/parallel/detail/untracked_pair.hpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/boost/property_map/parallel/detail/untracked_pair.hpp b/boost/property_map/parallel/detail/untracked_pair.hpp
new file mode 100644
index 0000000000..779ee6cc2e
--- /dev/null
+++ b/boost/property_map/parallel/detail/untracked_pair.hpp
@@ -0,0 +1,81 @@
+// Copyright (C) 2007 Matthias Troyer
+//
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//
+// This file contains helper data structures for use in transmitting
+// properties. The basic idea is to optimize away any storage for the
+// properties when no properties are specified.
+#ifndef BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
+#define BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP
+
+#include <boost/mpi/datatype.hpp>
+#include <utility> // for std::pair
+#include <boost/serialization/utility.hpp>
+
+namespace boost { namespace parallel { namespace detail {
+
+/**
+ * This structure is like std::pair, with the only difference
+ * that tracking in the serialization library is turned off.
+ */
+
+template<typename T, typename U>
+struct untracked_pair : public std::pair<T,U>
+{
+ untracked_pair() {}
+
+ untracked_pair(const T& t, const U& u)
+ : std::pair<T,U>(t,u) {}
+
+ template<class T1, class U1>
+ untracked_pair(std::pair<T1,U1> const& p)
+ : std::pair<T,U>(p) {}
+};
+
+template<typename T, typename U>
+inline untracked_pair<T, U>
+make_untracked_pair(const T& t, const U& u)
+{
+ return untracked_pair<T,U>(t,u);
+}
+
+} } } // end namespace boost::parallel::detail
+
+namespace boost { namespace mpi {
+
+template<typename T, typename U>
+struct is_mpi_datatype<boost::parallel::detail::untracked_pair<T, U> >
+ : is_mpi_datatype<std::pair<T,U> > {};
+
+} } // end namespace boost::mpi
+
+namespace boost { namespace serialization {
+
+// pair
+template<class Archive, class F, class S>
+inline void serialize(
+ Archive & ar,
+ boost::parallel::detail::untracked_pair<F, S> & p,
+ const unsigned int /* file_version */
+){
+ ar & boost::serialization::make_nvp("first", p.first);
+ ar & boost::serialization::make_nvp("second", p.second);
+}
+
+template<typename T, typename U>
+struct is_bitwise_serializable<
+ boost::parallel::detail::untracked_pair<T, U> >
+ : is_bitwise_serializable<std::pair<T, U> > {};
+
+template<typename T, typename U>
+struct implementation_level<boost::parallel::detail::untracked_pair<T, U> >
+ : mpl::int_<object_serializable> {} ;
+
+template<typename T, typename U>
+struct tracking_level<boost::parallel::detail::untracked_pair<T, U> >
+ : mpl::int_<track_never> {} ;
+
+} } // end namespace boost::serialization
+
+#endif // BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP