fix doc example typo
[boost.git] / boost / mpi / detail / broadcast_sc.hpp
blobc84da662a27aa0159d7a5c7088d524f159e274d3
1 // Copyright (C) 2005, 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
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 // http://www.boost.org/LICENSE_1_0.txt)
7 // Allows broadcast of skeletons via proxy.
9 // This header may only be included after both the broadcast.hpp and
10 // and skeleton_and_content.hpp headers have been included.
11 #ifndef BOOST_MPI_BROADCAST_SC_HPP
12 #define BOOST_MPI_BROADCAST_SC_HPP
14 namespace boost { namespace mpi {
16 template<typename T>
17 inline void
18 broadcast(const communicator& comm, skeleton_proxy<T>& proxy, int root)
20 const skeleton_proxy<T>& const_proxy(proxy);
21 broadcast(comm, const_proxy, root);
24 template<typename T>
25 void
26 broadcast(const communicator& comm, const skeleton_proxy<T>& proxy, int root)
28 if (comm.rank() == root) {
29 packed_skeleton_oarchive oa(comm);
30 oa << proxy.object;
31 broadcast(comm, oa, root);
32 } else {
33 packed_skeleton_iarchive ia(comm);
34 broadcast(comm, ia, root);
35 ia >> proxy.object;
39 } } // end namespace boost::mpi
41 #endif // BOOST_MPI_BROADCAST_SC_HPP