22 template <
typename ExpSet>
24 :
public ExpSet::const_visitor
28 using super_t =
typename expressionset_t::const_visitor;
37 constexpr
static const char*
me() {
return "constant_term"; }
51 return std::move(
res_);
59 return std::move(
res_);
82 res_ = std::move(res);
87 template <
typename Node>
93 res_ = std::move(res);
138 template <
bool = context_t::is_lat,
139 typename Dummy =
void>
146 using rs_t =
typename expressionset_t::template focus_t<I>;
152 template <
size_t... I>
166 template <
typename Dummy>
189 template <
typename ExpSet>
202 template <
typename ExpSet>
206 const auto& e = exp->as<ExpSet>();
208 constant_term<ExpSet>(e.expressionset(),
constant_term_visitor(const weightset_t &ws)
typename super_t::tuple_t tuple_t
VCSN_RAT_VISIT(shuffle, v)
weightset_t_of< expressionset_t > weightset_t
VCSN_RAT_VISIT(rweight, v)
A functor to compute the constant term of an expression.
weight_t operator()(const tuple_t &)
VCSN_RAT_VISIT(conjunction, v)
VCSN_RAT_VISIT(infiltration, v)
void visit(const tuple_t &v, std::true_type) override
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
VCSN_RAT_VISIT(lweight, v)
weight_t work_(const tuple_t &v)
Constant term for one tape.
std::shared_ptr< const detail::weight_base > weight
VCSN_RAT_VISIT(transposition, v)
weight_t operator()(const expression_t &v)
weight make_weight(const WeightSet &ws, const typename WeightSet::value_t &w)
VCSN_RAT_VISIT(complement, v)
typename expressionset_t::value_t expression_t
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
weight_t_of< ExpSet > constant_term(const ExpSet &rs, const typename ExpSet::value_t &e)
The constant term of e.
weight_t work_(const tuple_t &v, detail::index_sequence< I...>)
Product of the constant-terms of all tapes.
void visit_product(const Node &v)
Visit a variadic node whose constant-term is the product of the constant-terms of its children...
weight_t_of< expressionset_t > weight_t
constant_term_visitor(const expressionset_t &rs)
weight_t operator()(const tuple_t &v)
Entry point.
VCSN_RAT_UNSUPPORTED(ldiv)
y, yet both operands have a null constant-term.
context_t_of< expressionset_t > context_t
weight_t constant_term(const expression_t &v)
Easy recursion.
An inner node implementing a weight.
std::shared_ptr< detail::expression_base > expression
typename expressionset_t::const_visitor super_t
#define BUILTIN_UNREACHABLE()
static constexpr const char * me()
Name of this algorithm, for error messages.
weight constant_term(const expression &exp)
Bridge.
An inner node with multiple children.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of