defrag_states: do not take the argument by rvalue ref

Reported by Michaël Cadilhac.

* spot/graph/graph.hh, spot/twa/twagraph.hh: Take the renaming vector
by reference, not rvalue reference.  Document that
twa_graph::defrag_states may modify the vector.  Keep a deprecated
version of the old prototype just in case.  While there, also hide
this method from Swig.
* spot/twa/twagraph.cc: Simplify all calls to defrag_states().
* NEWS: Mention the change.
This commit is contained in:
Alexandre Duret-Lutz 2021-02-18 23:30:40 +01:00
parent 0b048e1c05
commit 7a56ae958e
5 changed files with 43 additions and 11 deletions

View file

@ -1302,7 +1302,9 @@ namespace spot
///
/// \param used_states the number of states used (after
/// renumbering)
void defrag_states(std::vector<unsigned>&& newst, unsigned used_states)
///
///@{
void defrag_states(const std::vector<unsigned>& newst, unsigned used_states)
{
SPOT_ASSERT(newst.size() >= states_.size());
SPOT_ASSERT(used_states > 0);
@ -1368,5 +1370,13 @@ namespace spot
//std::cerr << "\nafter defrag\n";
//dump_storage(std::cerr);
}
// prototype was changed in Spot 2.10
SPOT_DEPRECATED("use reference version of this method")
void defrag_states(std::vector<unsigned>&& newst, unsigned used_states)
{
return defrag_states(newst, used_states);
}
///@}
};
}