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;
136 const_iterator begin()
const;
137 const_iterator end()
const;
142 const value_t operator[](
size_t n)
const;
150 auto tail()
const -> decltype(boost::make_iterator_range(*
this, 1, 0));
154 template <
typename... Vs>
156 : sub_{std::forward<Vs>(vs)...}
172 template <
typename Context,
bool Enable>
174 :
public inner<Context>
177 static_assert(Context::is_lat,
178 "tuple: requires a tupleset labelset");
184 template <
unsigned Tape>
186 = std::shared_ptr<const rat::node<detail::project_context<Tape, context_t>>>;
188 template <
typename Sequence>
189 struct values_t_impl;
191 template <
size_t... I>
192 struct values_t_impl<detail::index_sequence<I...>>
194 using type = std::tuple<value_t_of<I>...>;
199 template <
typename... Args>
200 tuple(Args&&... args)
201 : sub_{std::forward<Args>(args)...}
210 const values_t sub()
const {
return sub_; }
216 template <
typename Context>
217 class tuple<Context, false>
218 :
public inner<Context>
225 template <exp::type_t Type,
typename Context>
227 :
public inner<Context>
230 static_assert(
is_unary(Type),
"invalid type");
254 template <exp::type_t Type,
typename Context>
256 :
public inner<Context>
270 const weight_t&
weight()
const;
271 void set_weight(weight_t w);
288 template <
typename Context>
290 :
public node<Context>
297 template <exp::type_t Type,
typename Context>
299 :
public leaf<Context>
313 template <
typename Context>
315 :
public leaf<Context>
328 const label_t& value()
const;
An inner node with multiple children.
bool is_unary() const
Whether star, complement.
bool is_leaf() const
Whether a leaf of the expression tree.
std::shared_ptr< const node_t > value_t
An expression usable with value semantics.
std::vector< value_t > values_t
constexpr bool is_unary(type_t t)
Whether star, complement.
The root from which to derive the final node types.
vcsn::rat::const_visitor< context_t > const_visitor
Container::value_type back(const Container &container)
The last member of this Container.
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).
rat::type_t type_t
The possible types of expressions.
The abstract parameterized, root for all rational expression types.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
virtual type_t type() const =0
The type of this node.
std::string type(const automaton &a)
The implementation type of a.
virtual void accept(const_visitor &v) const =0
void visit(const tuple< context_t > &v)
constexpr bool is_variadic(type_t t)
Whether one of the variadic types.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
value_impl< detail::weight_tag > weight
Implementation of nodes of tuple of rational expressions.
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
An inner node implementing a weight.
type_t
The possible types of expressions.
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
The abstract, non-parameterized, root for all rational expression node types.