KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::mpi_type_traits< T, Enable > Struct Template Reference

The type trait that maps a C++ type T to a type trait that can be used to construct an MPI_Datatype. More...

#include <mpi_datatype.hpp>

Detailed Description

template<typename T, typename Enable = void>
struct kamping::mpi_type_traits< T, Enable >

The type trait that maps a C++ type T to a type trait that can be used to construct an MPI_Datatype.

The default behavior is controlled by type_dispatcher. If you want to support a type that is not supported by the default behavior, you can specialize this trait. For example:

struct MyType {
int a;
double b;
char c;
std::array<int, 3> d;
};
namespace kamping {
// using KaMPIng's built-in struct serializer
template <>
struct mpi_type_traits<MyType> : struct_type<MyType> {};
// or using an explicitly constructed type
template <>
struct mpi_type_traits<MyType> {
static constexpr bool has_to_be_committed = true;
static MPI_Datatype data_type() {
MPI_Datatype type;
MPI_Type_create_*(..., &type);
return type;
}
};
} // namespace kamping
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
The type trait that maps a C++ type T to a type trait that can be used to construct an MPI_Datatype.
Definition mpi_datatype.hpp:203
Constructs a MPI_Datatype for a struct-like type.
Definition mpi_datatype.hpp:96

The documentation for this struct was generated from the following file: