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});
typename weightset_t::value_t weight_t
static constexpr bool weight()
transition_(weight_t w, state_t d, transition_t t)
Aut aut_
The automaton whose transitions are cached.
Functor to compare Values of ValueSets.
Outgoing signature: weight, destination.
transition_< weight_t, false > transition
Outgoing signature: weight, destination, and possibly transition identifier.
weight_t wgt
The (converted) weight.
std::conditional_t< Deterministic, transition, std::vector< transition >> transitions_t
const weightset_t & ws_
The result weightset.
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.
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
transition_(weight_t w, state_t d, transition_t)
map_t & operator[](state_t s)
Outgoing transitions of state s, sorted by label.
std::map< label_t_of< Aut >, transitions_t, less< labelset_t_of< Aut >>> map_t
size_t states_size(const Aut &aut)
The largest state number, plus one.
void insert_(map_t &map, label_t_of< Aut > l, transition t, std::enable_if_t<!Deterministic_ > *=nullptr)
Insert l -> t in map.
auto all_out(const Aut &aut, state_t_of< Aut > s)
Indexes of transitions leaving state s.
Cache the outgoing transitions of an automaton as efficient maps label -> vector<(weight, dst)>.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
state_t_of< Aut > state_t
State index type.
transition_(weight_t, state_t d, transition_t)
static constexpr weight_t weight()
std::vector< std::unique_ptr< map_t >> maps_t
For each state number, its transition map.
transition_map(const Aut &aut)
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.
weightset_t_of< automaton_t > weightset_t
typename detail::transition_t_of_impl< base_t< ValueSet >>::type transition_t_of
transition_map(transition_map &&that)
transition_map(const Aut &aut, const weightset_t &ws)
void build_map_(map_t &map, state_t s)
Build the transition map for state s, store at map.
transition_t_of< Aut > transition_t
Transition index type.