, block_indices_(new MPI_Aint[count])
, old_type_(old_type)
{
- auto* ints = new int[count + 1];
+ std::vector<int> ints(count + 1);
ints[0]=count;
for(int i=1;i<=count;i++)
ints[i]=block_lengths[i-1];
- contents_ = new Datatype_contents(MPI_COMBINER_HINDEXED, count+1, ints, count, block_indices, 1, &old_type);
- delete[] ints;
+ contents_ = new Datatype_contents(MPI_COMBINER_HINDEXED, count + 1, ints.data(), count, block_indices, 1, &old_type);
old_type_->ref();
for (int i = 0; i < count; i++) {
block_lengths_[i] = block_lengths[i];
: Type_Hindexed(size, lb, ub, flags, count, block_lengths, block_indices, old_type, old_type->get_extent())
{
delete contents_;
- auto* ints = new int[2 * count + 1];
+ std::vector<int> ints(2 * count + 1);
ints[0]=count;
for(int i=1;i<=count;i++)
ints[i]=block_lengths[i-1];
for(int i=count+1;i<=2*count;i++)
ints[i]=block_indices[i-count-1];
- contents_ = new Datatype_contents(MPI_COMBINER_INDEXED, 2*count+1, ints, 0, nullptr, 1, &old_type);
- delete[] ints;
+ contents_ = new Datatype_contents(MPI_COMBINER_INDEXED, 2 * count + 1, ints.data(), 0, nullptr, 1, &old_type);
}
int Type_Indexed::clone(MPI_Datatype* type)
, block_indices_(new MPI_Aint[count])
, old_types_(new MPI_Datatype[count])
{
- auto* ints = new int[count + 1];
+ std::vector<int> ints(count + 1);
ints[0]=count;
for(int i=1;i<=count;i++)
ints[i]=block_lengths[i-1];
- contents_ = new Datatype_contents(MPI_COMBINER_INDEXED, count+1, ints, count, block_indices, count, old_types);
- delete[] ints;
+ contents_ =
+ new Datatype_contents(MPI_COMBINER_INDEXED, count + 1, ints.data(), count, block_indices, count, old_types);
for (int i = 0; i < count; i++) {
block_lengths_[i]=block_lengths[i];
block_indices_[i]=block_indices[i];