Skip to content

Commit

Permalink
#1501: vrt_coll: fix copy constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Aug 19, 2021
1 parent 3aaf01b commit 51fa351
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
35 changes: 34 additions & 1 deletion src/vt/vrt/collection/param/construct_po.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,37 @@ struct ConstructParams {

public:
ConstructParams() = default;
ConstructParams(ConstructParams const&) = default;
ConstructParams(ConstructParams&&) = default;

ConstructParams(ConstructParams const& x)
: bounds_(x.bounds_),
has_bounds_(x.has_bounds_),
bulk_inserts_(x.bulk_inserts_),
bulk_insert_bounds_(x.bulk_insert_bounds_),
cons_fn_(x.cons_fn_),
dynamic_membership_(x.dynamic_membership_),
collective_(x.collective_),
constructed_(x.constructed_),
migratable_(x.migratable_),
map_han_(x.map_han_),
proxy_bits_(x.proxy_bits_),
map_object_(x.map_object_)
{
vtAssert(
not collective_,
"Should only call copy ctor during rooted construction"
);
if (x.list_inserts_.size() > 0 or
x.list_insert_here_.size() > 0) {
vtAbort(
"listInsert/listInsertHere can not be used with rooted construction"
);
}
if (x.cons_fn_) {
vtAbort("elementConstructor can not be used with rooted construction");
}
}

friend CollectionManager;

~ConstructParams() {
Expand Down Expand Up @@ -190,6 +218,8 @@ struct ConstructParams {
/**
* \brief Specify a non-default constructor for each element
*
* \note Only valid with collective construction
*
* \param[in] in_cons_fn the construction function
*/
ThisType&& elementConstructor(ConstructFnType in_cons_fn) {
Expand Down Expand Up @@ -351,6 +381,9 @@ struct ConstructParams {
| map_han_
| proxy_bits_
| map_object_;
s.skip(list_inserts_);
s.skip(list_insert_here_);
s.skip(cons_fn_);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/param/construct_po_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ConstructParamMsg : vt::Message {
vt_msg_serialize_required(); // po

ConstructParamMsg() = default;
explicit ConstructParamMsg(param::ConstructParams<ColT> in_po)
explicit ConstructParamMsg(param::ConstructParams<ColT>& in_po)
: po(in_po)
{ }

Expand Down

0 comments on commit 51fa351

Please sign in to comment.