32 bool Deterministic =
false,
34 bool KeepTransitions =
false>
43 using weight_t =
typename weightset_t::value_t;
46 template <
typename Weight =
weight_t,
47 bool KeepTransitions_ =
false,
typename Dummy =
void>
61 template <
typename Dummy>
73 template <
typename Weight,
typename Dummy>
88 template <
typename Dummy>
94 static constexpr
bool weight() {
return true; }
104 = std::conditional_t<Deterministic,
106 std::vector<transition>>;
132 if (
maps_.size() <= s)
134 auto capacity =
maps_.capacity();
135 while (capacity <= s)
137 maps_.reserve(capacity);
143 res = std::make_unique<map_t>();
151 using maps_t = std::vector<std::unique_ptr<map_t>>;
154 template <
bool Deterministic_>
158 std::enable_if_t<Deterministic_>* =
nullptr)
164 template <
bool Deterministic_>
168 std::enable_if_t<!Deterministic_>* =
nullptr)
170 map[l].emplace_back(t);
178 if (AllOut || !
aut_->labelset()->is_special(
aut_->label_of(t)))
180 auto w =
ws_.conv(*
aut_->weightset(),
aut_->weight_of(t));
181 insert_<Deterministic>(
map,
183 transition{w,
aut_->dst_of(t), t});
map_t & operator[](state_t s)
Outgoing transitions of state s, sorted by label.
transition_< weight_t, false > transition
Outgoing signature: weight, destination, and possibly transition identifier.
Aut aut_
The automaton whose transitions are cached.
transition_(weight_t w, state_t d, transition_t t)
typename detail::transition_t_of_impl< base_t< ValueSet >>::type transition_t_of
typename weightset_t::value_t weight_t
void build_map_(map_t &map, state_t s)
Build the transition map for state s, store at map.
std::conditional_t< Deterministic, transition, std::vector< transition >> transitions_t
size_t states_size(const Aut &aut)
The largest state number, plus one.
weight_t wgt
The (converted) weight.
transition_t_of< Aut > transition_t
Transition index type.
Outgoing signature: weight, destination.
void insert_(map_t &map, label_t_of< Aut > l, transition t, std::enable_if_t<!Deterministic_ > *=nullptr)
Insert l -> t in map.
transition_(weight_t w, state_t d, transition_t)
const weightset_t & ws_
The result weightset.
std::map< label_t_of< Aut >, transitions_t, less< labelset_t_of< Aut >>> map_t
void insert_(map_t &map, label_t_of< Aut > l, transition t, std::enable_if_t< Deterministic_ > *=nullptr)
Insert l -> t in map.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
transition_map(transition_map &&that)
transition_(weight_t, state_t d, transition_t)
state_t_of< Aut > state_t
State index type.
weightset_t_of< automaton_t > weightset_t
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
static constexpr weight_t weight()
auto map(const std::tuple< Ts... > &ts, Fun f) -> decltype(map_tuple_(f, ts, make_index_sequence< sizeof...(Ts)>()))
Map a function on a tuple, return tuple of the results.
Functor to compare Values of ValueSets.
std::vector< std::unique_ptr< map_t >> maps_t
For each state number, its transition map.
Cache the outgoing transitions of an automaton as efficient maps label -> vector<(weight, dst)>.
weight_t wgt
The (converted) weight.
auto all_out(const Aut &aut, state_t_of< Aut > s)
Indexes of transitions leaving state s.
static constexpr bool weight()
transition_(weight_t, state_t d, transition_t t)
transition_map(const Aut &aut)
transition_map(const Aut &aut, const weightset_t &ws)