1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
diff --git a/include/boost/mpi/datatype.hpp b/include/boost/mpi/datatype.hpp
index ef8aa2e..b9d4902 100644
--- a/include/boost/mpi/datatype.hpp
+++ b/include/boost/mpi/datatype.hpp
@@ -212,10 +212,6 @@ BOOST_MPI_DATATYPE(packed, MPI_PACKED, builtin);
/// INTERNAL ONLY
BOOST_MPI_DATATYPE(char, MPI_CHAR, builtin);
-/// INTERNAL ONLY
-/// We need to pick a boolean type, MPI_CXX_BOOL seems appropriate
-BOOST_MPI_DATATYPE(bool, MPI_CXX_BOOL, logical);
-
/// INTERNAL ONLY
BOOST_MPI_DATATYPE(short, MPI_SHORT, integer);
@@ -321,6 +317,33 @@ BOOST_MPI_DATATYPE(signed char, MPI_SIGNED_CHAR, builtin);
#endif // Doxygen
+namespace detail {
+ inline MPI_Datatype build_mpi_datatype_for_bool()
+ {
+ // this is explicitly freed in mpi_datatype_map::clear
+ MPI_Datatype type;
+ MPI_Type_contiguous(sizeof(bool), MPI_BYTE, &type);
+ MPI_Type_commit(&type);
+ return type;
+ }
+}
+
+/// Support for bool. There is no corresponding MPI_BOOL.
+/// INTERNAL ONLY
+template<>
+inline MPI_Datatype get_mpi_datatype<bool>(const bool&)
+{
+ static MPI_Datatype type = detail::build_mpi_datatype_for_bool();
+ return type;
+}
+
+/// INTERNAL ONLY
+template<>
+struct is_mpi_datatype<bool>
+ : boost::mpl::bool_<true>
+{};
+
+
#ifndef BOOST_MPI_DOXYGEN
// direct support for special primitive data types of the serialization library
BOOST_MPI_DATATYPE(boost::serialization::library_version_type, get_mpi_datatype(uint_least16_t()), integer);
|