Browse Source

Included move-construction and move-assignment for partition.

Former-commit-id: 8ed399c308
main
dehnert 10 years ago
parent
commit
56ea5fca14
  1. 49
      src/storage/DeterministicModelBisimulationDecomposition.h

49
src/storage/DeterministicModelBisimulationDecomposition.h

@ -275,43 +275,26 @@ namespace storm {
Partition() = default; Partition() = default;
Partition(Partition const& other) = default; Partition(Partition const& other) = default;
Partition& operator=(Partition const& other) = default; Partition& operator=(Partition const& other) = default;
#ifdef WINDOWS // Define move-construct and move-assignment explicitly to make sure they exist (as they are vital to
Partition(Partition&& other) // keep validity of pointers.
: blocks(), numberOfBlocks(other.numberOfBlocks), stateToBlockMapping(), statesAndValues(), positions(), keepSilentProbabilities(other.keepSilentProbabilities), silentProbabilities() Partition(Partition&& other) : blocks(std::move(other.blocks)), numberOfBlocks(other.numberOfBlocks), stateToBlockMapping(std::move(other.stateToBlockMapping)), statesAndValues(std::move(other.statesAndValues)), positions(std::move(other.positions)), keepSilentProbabilities(other.keepSilentProbabilities), silentProbabilities(std::move(other.silentProbabilities)) {
{ // Intentionally left empty.
//std::cout << "Partition(Partition&& other)" << std::endl;
//std::cout.flush();
blocks.swap(other.blocks);
other.numberOfBlocks = 0;
stateToBlockMapping.swap(other.stateToBlockMapping);
statesAndValues.swap(other.statesAndValues);
positions.swap(other.positions);
silentProbabilities.swap(other.silentProbabilities);
} }
Partition& operator=(Partition&& other) Partition& operator=(Partition&& other) {
{ if (this != &other) {
//std::cout << "Partition& operator=(Partition&& other)" << std::endl; blocks = std::move(other.blocks);
//std::cout.flush(); numberOfBlocks = other.numberOfBlocks;
blocks.clear(); stateToBlockMapping = std::move(other.stateToBlockMapping);
blocks.swap(other.blocks); statesAndValues = std::move(other.statesAndValues);
numberOfBlocks = other.numberOfBlocks; positions = std::move(other.positions);
other.numberOfBlocks = 0; keepSilentProbabilities = other.keepSilentProbabilities;
stateToBlockMapping.clear(); silentProbabilities = std::move(other.silentProbabilities);
stateToBlockMapping.swap(other.stateToBlockMapping); }
statesAndValues.clear();
statesAndValues.swap(other.statesAndValues);
positions.clear();
positions.swap(other.positions);
keepSilentProbabilities = other.keepSilentProbabilities;
silentProbabilities.clear();
silentProbabilities.swap(other.silentProbabilities);
return *this; return *this;
} }
#else
Partition(Partition&& other) = default;
Partition& operator=(Partition&& other) = default;
#endif
/*! /*!
* Splits all blocks of the partition such that afterwards all blocks contain only states with the label * Splits all blocks of the partition such that afterwards all blocks contain only states with the label

|||||||
100:0
Loading…
Cancel
Save