3 #include <boost/range/algorithm/lexicographical_compare.hpp>
20 template <
typename ExpSet>
22 :
public ExpSet::const_visitor
31 using super_t =
typename expressionset_t::const_visitor;
32 using node_t =
typename super_t::node_t;
33 using inner_t =
typename super_t::inner_t;
34 template <rat::exp::type_t Type>
36 template <rat::exp::type_t Type>
38 template <rat::exp::type_t Type>
53 size_t lhss = size<ExpSet>(lhs);
54 size_t rhss = size<ExpSet>(rhs);
60 else if (lhs->type() < rhs->type())
62 else if (lhs->type() > rhs->type())
78 #define DEFINE(Type) \
79 VCSN_RAT_VISIT(Type, lhs) \
81 res_ = less_(lhs, *down_pointer_cast<const Type ## _t>(rhs_)); \
102 template <
bool = context_t::is_lat,
103 typename Dummy =
void>
106 using tupleset_t =
typename expressionset_t::template as_tupleset_t<>;
117 return tupleset_t::less(lhs.sub(), rhs.sub());
123 template <
typename Dummy>
142 bool less_(
const zero_t&,
const zero_t&)
152 bool less_(
const atom_t& lhs,
const atom_t& rhs)
154 return labelset_t::less(lhs.value(), rhs.value());
157 template <rat::exp::type_t Type>
158 bool less_(
const variadic_t<Type>& lhs,
const variadic_t<Type>& rhs)
160 using boost::range::lexicographical_compare;
161 auto ls = lhs.size();
162 auto rs = rhs.size();
168 return lexicographical_compare(lhs, rhs,
172 template <rat::exp::type_t Type>
173 bool less_(
const unary_t<Type>& lhs,
const unary_t<Type>& rhs)
175 return expressionset_t::less(lhs.sub(), rhs.sub());
178 template <rat::exp::type_t Type>
179 bool less_(
const weight_node_t<Type>& lhs,
const weight_node_t<Type>& rhs)
182 if (expressionset_t::less(lhs.sub(), rhs.sub()))
184 else if (expressionset_t::less(rhs.sub(), lhs.sub()))
187 return weightset_t::less(lhs.weight(), rhs.weight());
typename super_t::template unary_t< Type > unary_t
bool res_
The current result.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
bool operator()(const tuple_t &lhs)
Entry point: down_cast rhs_ and bounce to binary operator().
decltype(std::declval< LabelSet >().one()) one_t
bool operator()(const tuple_t &lhs, const tuple_t &rhs)
Binary operator().
labelset_t_of< context_t > labelset_t
A functor to check whether one rational expression is (strictly) less than another one...
expression_t rhs_
The right-hand side expression with which the current node is compared.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
typename super_t::template variadic_t< Type > variadic_t
An inner node with multiple children.
bool less_(const variadic_t< Type > &lhs, const variadic_t< Type > &rhs)
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
weightset_t_of< context_t > weightset_t
bool less_(const unary_t< Type > &lhs, const unary_t< Type > &rhs)
#define BUILTIN_UNREACHABLE()
context_t_of< expressionset_t > context_t
weight_t_of< context_t > weight_t
bool less_(const weight_node_t< Type > &lhs, const weight_node_t< Type > &rhs)
bool less_(const zero_t &, const zero_t &)
typename expressionset_t::template as_tupleset_t<> tupleset_t
typename super_t::inner_t inner_t
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
typename super_t::template weight_node_t< Type > weight_node_t
typename super_t::node_t node_t
typename expressionset_t::const_visitor super_t
bool less_(const one_t &, const one_t &)
An inner node implementing a weight.
bool operator()(expression_t lhs, expression_t rhs)
Whether lhs < rhs.
typename super_t::tuple_t tuple_t
void visit(const tuple_t &v, std::true_type) override
typename expressionset_t::value_t expression_t
bool operator()(const tuple_t &)
bool less_(const atom_t &lhs, const atom_t &rhs)
Functor to compare Values of ValueSets.