Skip to content

ygm::container variable reassignment using std::swap #115

@bwpriest

Description

@bwpriest

It would be valuable to reassign container objects inline using the = operator. For example, I have workflows where I iteratively build containers while discarding old versions. It would be very convenient to do so via something like:

ygm::container::map<key_type, value_type> my_map = make_map();
while(condition == true) {
  my_map = make_new_map(my_map);
}

This does not currently work, and I believe we need to add an overloaded = operator for each container with an implementation like

container_type &operator=(container_type rhs) {
  std::swap(*this, rhs);
  return *this;
}

We will probably need to do some accounting with the ygm_ptrs for the objects in this case, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions