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_)); \
103 template <
typename =
void>
106 using tupleset_t =
typename expressionset_t::template as_tupleset_t<>;
117 return tupleset_t::less(lhs.sub(), rhs.sub());
125 detail::static_if<context_t::is_lat>
137 bool less_(
const zero_t&,
const zero_t&)
147 bool less_(
const atom_t& lhs,
const atom_t& rhs)
149 return labelset_t::less(lhs.value(), rhs.value());
152 template <rat::exp::type_t Type>
153 bool less_(
const variadic_t<Type>& lhs,
const variadic_t<Type>& rhs)
155 using boost::range::lexicographical_compare;
156 auto ls = lhs.size();
157 auto rs = rhs.size();
163 return lexicographical_compare(lhs, rhs,
167 template <rat::exp::type_t Type>
168 bool less_(
const unary_t<Type>& lhs,
const unary_t<Type>& rhs)
170 return expressionset_t::less(lhs.sub(), rhs.sub());
173 template <rat::exp::type_t Type>
174 bool less_(
const weight_node_t<Type>& lhs,
const weight_node_t<Type>& rhs)
177 if (expressionset_t::less(lhs.sub(), rhs.sub()))
179 else if (expressionset_t::less(rhs.sub(), lhs.sub()))
182 return weightset_t::less(lhs.weight(), rhs.weight());
labelset_t_of< context_t > labelset_t
bool less_(const atom_t &lhs, const atom_t &rhs)
bool operator()(const tuple_t &lhs)
Entry point: down_cast rhs_ and bounce to binary operator().
typename super_t::template unary_t< Type > unary_t
typename super_t::template variadic_t< Type > variadic_t
weight_t_of< context_t > weight_t
Functor to compare Values of ValueSets.
An inner node implementing a weight.
typename super_t::inner_t inner_t
bool less_(const weight_node_t< Type > &lhs, const weight_node_t< Type > &rhs)
context_t_of< expressionset_t > context_t
typename expressionset_t::value_t expression_t
decltype(std::declval< LabelSet >().one()) one_t
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
typename expressionset_t::template as_tupleset_t<> tupleset_t
typename super_t::template weight_node_t< Type > weight_node_t
bool operator()(expression_t lhs, expression_t rhs)
Whether lhs < rhs.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
bool less_(const one_t &, const one_t &)
bool less_(const unary_t< Type > &lhs, const unary_t< Type > &rhs)
bool less_(const variadic_t< Type > &lhs, const variadic_t< Type > &rhs)
typename super_t::node_t node_t
An inner node with multiple children.
weightset_t_of< context_t > weightset_t
bool res_
The current result.
expression_t rhs_
The right-hand side expression with which the current node is compared.
bool less_(const zero_t &, const zero_t &)
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
typename expressionset_t::const_visitor super_t
A functor to check whether one rational expression is (strictly) less than another one...
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
typename super_t::tuple_t tuple_t
bool operator()(const tuple_t &lhs, const tuple_t &rhs)
Binary operator().
void visit(const tuple_t &v, std::true_type) override