5 #include <boost/range.hpp>
23 virtual ~exp() =
default;
79 template <
typename Context>
81 :
public std::enable_shared_from_this<node<Context>>
88 using value_t = std::shared_ptr<const node_t>;
100 template <
typename Context>
102 :
public node<Context>
117 template <exp::type_t Type,
typename Context>
119 :
public inner<Context>
128 using const_iterator =
typename values_t::const_iterator;
132 using iterator = const_iterator;
133 using const_reverse_iterator =
typename values_t::const_reverse_iterator;
134 using reverse_iterator = const_reverse_iterator;
138 const_iterator begin()
const;
139 const_iterator end()
const;
140 const_reverse_iterator rbegin()
const;
141 const_reverse_iterator rend()
const;
146 const value_t operator[](
size_t n)
const;
154 auto tail()
const -> decltype(boost::make_iterator_range(*
this, 1, 0));
158 template <
typename... Vs>
160 : sub_{std::forward<Vs>(vs)...}
163 variadic(
const variadic& that)
181 template <
typename Context,
bool Enable>
183 :
public inner<Context>
186 static_assert(Context::is_lat,
187 "tuple: requires a tupleset labelset");
193 template <
unsigned Tape>
195 = std::shared_ptr<const rat::node<detail::project_context<Tape, context_t>>>;
197 template <
typename Sequence>
198 struct values_t_impl;
200 template <
size_t... I>
201 struct values_t_impl<detail::index_sequence<I...>>
203 using type = std::tuple<value_t_of<I>...>;
208 template <
typename... Args>
209 tuple(Args&&... args)
210 : sub_{std::forward<Args>(args)...}
219 const values_t sub()
const {
return sub_; }
225 template <
typename Context>
226 class tuple<Context, false>
227 :
public inner<Context>
234 template <exp::type_t Type,
typename Context>
236 :
public inner<Context>
239 static_assert(
is_unary(Type),
"invalid type");
263 template <exp::type_t Type,
typename Context>
265 :
public inner<Context>
279 const weight_t&
weight()
const;
280 void set_weight(weight_t w);
285 , weight_(that.weight_)
301 template <
typename Context>
303 :
public node<Context>
310 template <exp::type_t Type,
typename Context>
312 :
public leaf<Context>
326 template <
typename Context>
328 :
public leaf<Context>
341 const label_t& value()
const;
std::shared_ptr< const detail::weight_base > weight
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
type_t
The possible types of expressions.
std::vector< value_t > values_t
The abstract, non-parameterized, root for all rational expression node types.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
constexpr bool is_unary(type_t t)
Whether star, complement.
An inner node implementing a weight.
std::shared_ptr< const node_t > value_t
An expression usable with value semantics.
vcsn::rat::const_visitor< context_t > const_visitor
bool is_unary() const
Whether star, complement.
label_t_of< Context > label_t
virtual type_t type() const
The type of this node.
constexpr bool is_constant(type_t t)
Whether is a constant (\z or \e).
constexpr bool is_variadic(type_t t)
Whether one of the variadic types.
virtual void accept(const_visitor &v) const =0
std::string type(const automaton &a)
The implementation type of a.
The root from which to derive the final node types.
rat::type_t type_t
The possible types of expressions.
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
void visit(const tuple< context_t > &v)
An inner node with multiple children.
virtual type_t type() const =0
The type of this node.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
The abstract parameterized, root for all rational expression types.
bool is_leaf() const
Whether a leaf of the expression tree.
Implementation of nodes of tuple of rational expressions.
Container::value_type back(const Container &container)
The last member of this Container.