17 #ifndef VCSN_ALGORITHMS_INTERNAL_PARTIAL_RAT_EXP_CONSTANT_TERM_HXX
18 # define VCSN_ALGORITHMS_INTERNAL_PARTIAL_RAT_EXP_CONSTANT_TERM_HXX
26 template <
class Series,
class T>
27 std::pair<typename Element<Series, T>::semiring_elt_t,
bool>
28 constant_term(
const PartialExp<Series, T>& exp)
30 typedef typename PartialExp<Series, T>::const_iterator const_iterator;
31 typedef typename PartialExp<Series, T>::semiring_elt_t semiring_elt_t;
32 typedef typename PartialExp<Series, T>::series_set_elt_value_t
33 series_set_elt_value_t;
34 typedef std::pair<typename Element<Series, T>::semiring_elt_t,
bool>
37 const_iterator i = exp.begin();
38 semiring_elt_t res = i.semiring_elt();
41 for (i++; i != exp.end() && defined; ++i)
45 result_t tmp = constant_term(
46 Element<Series, T>(exp.exp_structure(),
47 series_set_elt_value_t (i.node())));
52 res *= i.semiring_elt();
54 return std::make_pair(res, defined);
59 #endif // ! VCSN_ALGORITHMS_INTERNAL_PARTIAL_RAT_EXP_CONSTANT_TERM_HXX