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:
parent
0b048e1c05
commit
7a56ae958e
5 changed files with 43 additions and 11 deletions
|
|
@ -328,7 +328,7 @@ namespace spot
|
|||
else
|
||||
s = -1U;
|
||||
|
||||
defrag_states(std::move(remap), st);
|
||||
defrag_states(remap, st);
|
||||
}
|
||||
|
||||
void twa_graph::purge_unreachable_states(shift_action* f, void* action_data)
|
||||
|
|
@ -383,7 +383,7 @@ namespace spot
|
|||
if (f)
|
||||
(*f)(todo, action_data);
|
||||
|
||||
defrag_states(std::move(todo), current);
|
||||
defrag_states(todo, current);
|
||||
}
|
||||
|
||||
void twa_graph::purge_dead_states()
|
||||
|
|
@ -580,13 +580,13 @@ namespace spot
|
|||
if (prop_complete().is_false())
|
||||
prop_complete(trival::maybe());
|
||||
|
||||
defrag_states(std::move(useful), current);
|
||||
defrag_states(useful, current);
|
||||
|
||||
if (purge_unreachable_needed)
|
||||
purge_unreachable_states();
|
||||
}
|
||||
|
||||
void twa_graph::defrag_states(std::vector<unsigned>&& newst,
|
||||
void twa_graph::defrag_states(std::vector<unsigned>& newst,
|
||||
unsigned used_states)
|
||||
{
|
||||
if (!is_existential())
|
||||
|
|
@ -660,7 +660,7 @@ namespace spot
|
|||
}
|
||||
else
|
||||
{
|
||||
// register this new destination group, add et two
|
||||
// register this new destination group, add it to
|
||||
// newst, and use the index in newst to relabel
|
||||
// the state so that graph::degrag_states() will
|
||||
// eventually update it to the correct value.
|
||||
|
|
@ -738,7 +738,7 @@ namespace spot
|
|||
}
|
||||
}
|
||||
init_number_ = newst[init_number_];
|
||||
g_.defrag_states(std::move(newst), used_states);
|
||||
g_.defrag_states(newst, used_states);
|
||||
}
|
||||
|
||||
void twa_graph::remove_unused_ap()
|
||||
|
|
|
|||
|
|
@ -689,6 +689,7 @@ namespace spot
|
|||
dests2.begin());
|
||||
}
|
||||
|
||||
#ifndef SWIG
|
||||
/// \brief Renumber all states, and drop some.
|
||||
///
|
||||
/// This semi-internal function is a wrapper around
|
||||
|
|
@ -705,11 +706,25 @@ namespace spot
|
|||
/// \param newst A vector indicating how each state should be
|
||||
/// renumbered. Use -1U to mark an unreachable state for removal.
|
||||
/// Ignoring the occurrences of -1U, the renumbering is expected
|
||||
/// to satisfy newst[i] ≤ i for all i.
|
||||
/// to satisfy newst[i] ≤ i for all i. If the automaton contains
|
||||
/// universal branching, this vector is likely to be modified by
|
||||
/// this function, so do not reuse it afterwards.
|
||||
///
|
||||
/// \param used_states the number of states used after
|
||||
/// renumbering.
|
||||
void defrag_states(std::vector<unsigned>&& newst, unsigned used_states);
|
||||
///@{
|
||||
void defrag_states(std::vector<unsigned>& newst,
|
||||
unsigned used_states);
|
||||
|
||||
// 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);
|
||||
}
|
||||
///@}
|
||||
#endif // SWIG
|
||||
|
||||
/// \brief Print the data structures used to represent the
|
||||
/// automaton in dot's format.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue