26 false, false, Aut, Auts...>
37 template <
size_t... I>
38 using seq =
typename super_t::template
seq<I...>;
48 using label_t =
typename labelset_t::value_t;
49 using weight_t =
typename weightset_t::value_t;
74 while (!
aut_->todo_.empty())
76 const auto& p =
aut_->todo_.front();
78 aut_->todo_.pop_front();
81 catch (
const std::runtime_error& e)
83 raise(e,
" while tupling automata");
99 template <std::size_t... I>
104 if (!
all((std::get<I>(psrc) == std::get<I>(
aut_->auts_)->post())...))
106 const auto& ls = *
aut_->labelset();
107 const auto& ws = *
aut_->weightset();
111 auto label = ls.special();
114 add_tape_transitions_<0>(src, psrc, dst,
label,
weight);
118 template <std::
size_t I>
123 const auto& ls = *
aut_->labelset();
124 const auto& ws = *
aut_->weightset();
125 const auto& aut = std::get<I>(
aut_->auts_);
129 if (std::get<I>(psrc) == aut->post())
133 ([
this](
auto src,
auto,
auto dst,
auto label,
auto weight)
137 aut_->set_final(src, weight);
139 aut_->new_transition(src,
state(dst), label, weight);
141 [
this](
auto src,
auto psrc,
auto dst,
auto label,
auto weight)
143 add_tape_transitions_<I + 1>(src, psrc, dst,
label,
weight);
145 (src, psrc, dst, label, weight);
148 for (
auto t: aut->all_out(std::get<I>(psrc)))
151 = aut->dst_of(t) == aut->post()
154 weight = ws.mul(weight, aut->weight_of(t));
155 std::get<I>(dst) = aut->dst_of(t);
157 ([
this,&ls,&ws](
auto src,
auto,
auto dst,
auto label,
auto weight)
161 aut_->set_final(src, weight);
163 aut_->new_transition(src,
state(dst), label, weight);
165 [
this](
auto src,
auto psrc,
auto dst,
auto label,
auto weight)
167 add_tape_transitions_<I + 1>(src, psrc, dst,
label,
weight);
169 (src, psrc, dst, label, weight);
199 template <
typename Auts,
size_t... I>
208 template <
typename Auts>
210 tuple(
const std::vector<automaton>& as)
214 return tuple_<Auts>(as, indices);
typename tuple_automaton_impl::state_name_t state_name_t
Decorator implementing the laziness for an algorithm.
value_impl< detail::weight_tag > weight
auto static_if(std::true_type, Then &&then, Else &&)
Execute the then-clause.
typename tuple_automaton_impl::state_t state_t
typename super_t::state_name_t state_name_t
automaton tuple(const std::vector< automaton > &as)
Bridge.
Aut automaton_t
The type of the resulting automaton.
context_t_of< Aut > context_t
The context of the result.
std::tuple< typename transition_map_t< Auts >::map_t &... > out_(const state_name_t &ss)
The outgoing tuple of transitions from state tuple ss.
mutable_automaton< Context > make_mutable_automaton(const Context &ctx)
void add_tape_transitions_(const state_t src, const state_name_t &psrc, state_name_t dst, label_t label, weight_t weight)
bool all(Bool &&...values)
Whether all the values evaluate as true.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
const weightset_t & ws_
The resulting weightset.
typename weightset_t::value_t weight_t
typename super_t::template seq< I... > seq
void add_tuple_transitions_(const state_t src, const state_name_t &psrc, seq< I... >)
typename super_t::state_t state_t
state_t state(Args &&...args)
Conversion from state name to state number.
Build the (accessible part of the) Cartesian product of automata.
typename labelset_t::value_t label_t
tuple_automata_impl(Aut aut, const Auts &...auts)
Build a tuple automaton.
automaton tuple_(const std::vector< automaton > &as, vcsn::detail::index_sequence< I... >)
Bridge helper.
auto label_one(const LabelSet &ls) -> typename LabelSet::value_t
Enjoy type inference.
void tuple()
Compute the (accessible part of the) tuple.
std::tuple< transition_map_t< Auts >... > transition_maps_
Transition caches.
auto tuple(const Auts &...as)
Build the (accessible part of the) tuple.
base_t< tuple_element_t< I, automata_t >> input_automaton_t
The type of the Ith input automaton, unqualified.
void add_tuple_transitions(const state_t src, const state_name_t &psrc)
Add transitions to the result automaton, starting from the given result input state, which must correspond to the given pair of input state automata.
typename std::tuple_element< I, T >::type tuple_element_t
C++14.
std::tuple< Auts... > automata_t
The type of input automata.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
std::remove_cv_t< std::remove_reference_t< T >> base_t
T without reference or const/volatile qualifiers.
value_impl< detail::label_tag > label
auto tuple_context(Ctx &&...ctx) -> context< tupleset< labelset_t_of< Ctx >... >, join_t< weightset_t_of< Ctx >... >>
weightset_t_of< context_t > weightset_t
automaton_t aut_
The wrapped automaton, possibly const.
labelset_t_of< context_t > labelset_t
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
tuple_automata_impl self_t