• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2005 The Trustees of Indiana University.
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 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 //  Authors: Douglas Gregor
8 //           Andrew Lumsdaine
9 
10 #ifndef BOOST_PARALLEL_BASIC_REDUCE_HPP
11 #define BOOST_PARALLEL_BASIC_REDUCE_HPP
12 
13 namespace boost { namespace parallel {
14 
15 /** Reduction operation used to reconcile differences between local
16  * and remote values for a particular key in a property map.  The
17  * type @c T is typically the @c value_type of the property
18  * map. This basic reduction returns a default-constructed @c T as
19  * the default value and always resolves to the remote value.
20  */
21 template<typename T>
22 struct basic_reduce
23 {
24   BOOST_STATIC_CONSTANT(bool, non_default_resolver = false);
25 
26   /// Returns a default-constructed T object
27   template<typename Key>
operator ()boost::parallel::basic_reduce28   T operator()(const Key&) const { return T(); }
29 
30   /// Returns the remote value
31   template<typename Key>
operator ()boost::parallel::basic_reduce32   const T& operator()(const Key&, const T&, const T& remote) const
33   { return remote; }
34 };
35 
36 } } // end namespace boost::parallel
37 
38 #endif // BOOST_PARALLEL_BASIC_REDUCE_HPP
39