| Home | Libraries | People | FAQ | More

## Struct template is_mpi_datatype

boost::mpi::is_mpi_datatype — Type trait that determines if a C++ type can be mapped to an MPI data type.

## Synopsis

    // In header: <boost/mpi/datatype.hpp>

    template<typename T>
    struct is_mpi_datatype : public boost::mpi::is_mpi_builtin_datatype< T > {
    };

## Description

This type trait determines if it is possible to build an MPI data type that represents a C++ data type. When this is the case, `is_mpi_datatype` derives `mpl::true_` and the MPI data type will be accessible via `get_mpi_datatype`.

For any C++ type that maps to a built-in MPI data type (see `is_mpi_builtin_datatype`), `is_mpi_data_type` is trivially true. However, any POD ("Plain Old Data") type containing types that themselves can be represented by MPI data types can itself be represented as an MPI data type. For instance, a `point3d` class containing three `double` values can be represented as an MPI data type. To do so, first make the data type Serializable (using the Boost.Serialization library); then, specialize the `is_mpi_datatype` trait for the point type so that it will derive `mpl::true_:`

    namespace boost { namespace mpi {
      template<> struct is_mpi_datatype<point>
        : public mpl::true_ { };
    } }