28 template <
typename Aut,
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 =
typename std::conditional<Deterministic,
118 auto lb =
maps_.lower_bound(s);
119 if (lb ==
maps_.end() ||
maps_.key_comp()(s, lb->first))
129 template <
bool Deterministic_>
139 template <
bool Deterministic_>
145 map[l].emplace_back(t);
153 auto& res =
maps_.emplace_hint(lb, s,
map_t{})->second;
154 for (
auto t:
aut_->all_out(s))
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});
transition_map(const Aut &aut)
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
transition_< weight_t, false > transition
Outgoing signature: weight, destination, and possibly transition identifier.
Outgoing signature: weight, destination.
weightset_t_of< automaton_t > weightset_t
weight_t wgt
The (converted) weight.
Functor to compare Values of ValueSets.
typename weightset_t::value_t weight_t
const weightset_t & ws_
The result weightset.
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.
std::string type(const automaton &a)
The implementation type of a.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
transition_(weight_t w, state_t d, transition_t)
weight_t wgt
The (converted) weight.
typename std::enable_if< Cond, T >::type enable_if_t
map_t & build_map_(typename maps_t::iterator lb, state_t s)
Build and return the transition map for state s, store at res.
std::map< state_t, map_t > maps_t
state_t_of< automaton_t > state_t
typename std::conditional< Deterministic, transition, std::vector< transition >>::type transitions_t
transition_t_of< automaton_t > transition_t
static constexpr bool weight()
static constexpr weight_t weight()
transition_(weight_t, state_t d, transition_t 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, vcsn::enable_if_t<!Deterministic_ > *=nullptr)
Insert l -> t in map.
Cache the outgoing transitions of an automaton as efficient maps label -> vector<(weight, dst)>.
transition_map(const Aut &aut, const weightset_t &ws)
transition_(weight_t, state_t d, transition_t)
transition_(weight_t w, state_t d, transition_t t)
Aut aut_
The automaton whose transitions are cached.
void insert_(map_t &map, label_t_of< Aut > l, transition t, vcsn::enable_if_t< Deterministic_ > *=nullptr)
Insert l -> t in map.
std::map< label_t_of< automaton_t >, transitions_t, less< labelset_t_of< automaton_t >>> map_t
map_t & operator[](state_t s)
Outgoing transitions of state s, sorted by label.