30 bool Deterministic =
false,
32 bool KeepTransitions =
false>
39 using weight_t =
typename weightset_t::value_t;
42 template <
typename Weight =
weight_t,
43 bool KeepTransitions_ =
false,
typename Dummy =
void>
57 template <
typename Dummy>
69 template <
typename Weight,
typename Dummy>
84 template <
typename Dummy>
90 static constexpr
bool weight() {
return true; }
97 using transition = transition_<weight_t, KeepTransitions>;
100 = std::conditional_t<Deterministic,
102 std::vector<transition>>;
118 auto lb =
maps_.lower_bound(s);
119 if (lb ==
maps_.end() ||
maps_.key_comp()(s, lb->first))
129 template <
bool Deterministic_>
133 std::enable_if_t<Deterministic_>* =
nullptr)
139 template <
bool Deterministic_>
143 std::enable_if_t<!Deterministic_>* =
nullptr)
145 map[l].emplace_back(t);
153 auto& res =
maps_.emplace_hint(lb, s,
map_t{})->second;
155 if (AllOut || !
aut_->labelset()->is_special(
aut_->label_of(t)))
157 auto w =
ws_.conv(*
aut_->weightset(),
aut_->weight_of(t));
158 insert_<Deterministic>(res,
160 transition{w,
aut_->dst_of(t), t});
auto all_out(const Aut &aut, state_t_of< Aut > s)
Indexes of transitions leaving state s.
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.
map_t & operator[](state_t s)
Outgoing transitions of state s, sorted by label.
map_t & build_map_(typename maps_t::iterator lb, state_t s)
Build and return the transition map for state s, store at res.
static constexpr bool weight()
transition_(weight_t w, state_t d, transition_t t)
weightset_t_of< automaton_t > weightset_t
Cache the outgoing transitions of an automaton as efficient maps label -> vector<(weight, dst)>.
transition_t_of< Aut > transition_t
transition_< weight_t, false > transition
Outgoing signature: weight, destination, and possibly transition identifier.
weight_t wgt
The (converted) weight.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
transition_(weight_t, state_t d, transition_t)
std::conditional_t< Deterministic, transition, std::vector< transition >> transitions_t
static constexpr weight_t weight()
weight_t wgt
The (converted) weight.
transition_(weight_t, state_t d, transition_t t)
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)
typename detail::transition_t_of_impl< base_t< ValueSet >>::type transition_t_of
void insert_(map_t &map, label_t_of< Aut > l, transition t, std::enable_if_t<!Deterministic_ > *=nullptr)
Insert l -> t in map.
transition_map(const Aut &aut, const weightset_t &ws)
const weightset_t & ws_
The result weightset.
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
Aut aut_
The automaton whose transitions are cached.
std::map< state_t, map_t > maps_t
state_t_of< Aut > state_t
typename weightset_t::value_t weight_t
transition_map(const Aut &aut)
std::map< label_t_of< Aut >, transitions_t, less< labelset_t_of< Aut >>> map_t
Functor to compare Values of ValueSets.
Outgoing signature: weight, destination.