6 #ifndef DUNE_COMMON_PARALLEL_MPIDATA_HH 7 #define DUNE_COMMON_PARALLEL_MPIDATA_HH 13 #include <type_traits> 40 template<
class,
class =
void>
49 template<
class T,
class Enable>
52 friend auto getMPIData<T>(T&);
72 MPI_Datatype
type()
const {
100 decltype(std::declval<T>().size()),
101 typename std::decay_t<T>::value_type>>>{
104 using hasResizeOp = decltype(std::declval<U>().resize(0));
107 friend auto getMPIData<T>(T&);
112 static constexpr
bool static_size = std::is_const<T>::value || !Std::is_detected_v<hasResizeOp, T>;
114 return (
void*)
data_.data();
123 template<
class S = T>
125 -> std::enable_if_t<!std::is_const<S>::value || !Std::is_detected_v<hasResizeOp, S>>
141 #endif // DUNE_COMMON_PARALLEL_MPIDATA_HH T & data_
Definition: mpidata.hh:131
void * ptr() const
Definition: mpidata.hh:61
auto getMPIData(T &t)
Definition: mpidata.hh:44
MPIData(T &t)
Definition: mpidata.hh:108
int size()
Definition: mpidata.hh:87
MPIData(T &t)
Definition: mpidata.hh:56
T & data_
Definition: mpidata.hh:54
MPIData()
Definition: mpidata.hh:81
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition: typetraits.hh:40
Definition: mpidata.hh:41
static constexpr bool static_size
Definition: mpidata.hh:66
int size()
Definition: mpidata.hh:116
Dune namespace
Definition: alignedallocator.hh:12
int size() const
Definition: mpidata.hh:68
MPI_Datatype type() const
Definition: mpidata.hh:91
void * ptr()
Definition: mpidata.hh:113
void * ptr()
Definition: mpidata.hh:84
Traits classes for mapping types onto MPI_Datatype.
MPI_Datatype type() const
Definition: mpidata.hh:119
A traits class describing the mapping of types onto MPI_Datatypes.
Definition: bigunsignedint.hh:29
MPI_Datatype type() const
Definition: mpidata.hh:72
Traits for type conversions and type information.
auto resize(int size) -> std::enable_if_t<!std::is_const< S >::value||!Std::is_detected_v< hasResizeOp, S >>
Definition: mpidata.hh:124