PageRenderTime 23ms CodeModel.GetById 8ms app.highlight 11ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/graph/parallel/detail/untracked_pair.hpp

http://hadesmem.googlecode.com/
C++ Header | 85 lines | 53 code | 19 blank | 13 comment | 0 complexity | cbbc626781609f932241be388ce39d75 MD5 | raw file
 1// Copyright (C) 2007 Matthias Troyer
 2//
 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
 5//
 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
11
12#ifndef BOOST_GRAPH_USE_MPI
13#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
14#endif
15
16#include <boost/mpi/datatype.hpp>
17#include <utility> // for std::pair
18#include <boost/serialization/utility.hpp>
19
20namespace boost { namespace parallel { namespace detail {
21
22/**
23 * This structure is like std::pair, with the only difference
24 * that tracking in the serialization library is turned off.
25 */
26 
27template<typename T, typename U>
28struct untracked_pair : public std::pair<T,U>
29{
30  untracked_pair() {}
31
32  untracked_pair(const T& t, const U& u)
33  : std::pair<T,U>(t,u) {}
34
35  template<class T1, class U1>
36  untracked_pair(std::pair<T1,U1> const& p)
37  : std::pair<T,U>(p) {}  
38};
39
40template<typename T, typename U>
41inline untracked_pair<T, U>
42make_untracked_pair(const T& t, const U& u)
43{
44  return untracked_pair<T,U>(t,u);
45}
46
47} } } // end namespace boost::parallel::detail
48
49namespace boost { namespace mpi {
50
51template<typename T, typename U>
52struct is_mpi_datatype<boost::parallel::detail::untracked_pair<T, U> >
53  : is_mpi_datatype<std::pair<T,U> > {};
54
55} } // end namespace boost::mpi
56
57namespace boost { namespace serialization {
58
59// pair
60template<class Archive, class F, class S>
61inline void serialize(
62    Archive & ar,
63    boost::parallel::detail::untracked_pair<F, S> & p,
64    const unsigned int /* file_version */
65){
66    ar & boost::serialization::make_nvp("first", p.first);
67    ar & boost::serialization::make_nvp("second", p.second);
68}
69
70template<typename T, typename U>
71struct is_bitwise_serializable<
72        boost::parallel::detail::untracked_pair<T, U> >
73  : is_bitwise_serializable<std::pair<T, U> > {};
74
75template<typename T, typename U>
76struct implementation_level<boost::parallel::detail::untracked_pair<T, U> >
77 : mpl::int_<object_serializable> {} ;
78
79template<typename T, typename U>
80struct tracking_level<boost::parallel::detail::untracked_pair<T, U> >
81 : mpl::int_<track_never> {} ;
82
83} } // end namespace boost::serialization
84
85#endif // BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP