65 std::ostream& output (std::ostream& o)
const {
72 for (
auto it =l.val.begin(); it != l.val.end(); it++) {
88 void static add_to_vect(std::list<any_t>&accu,
const H& head) {
89 accu.emplace_back(head);
92 template <
typename H,
typename...T>
93 void static add_to_vect
94 (std::list<any_t>& accu,
const H& head,
const T&... tail)
96 add_to_vect(accu,head);
97 add_to_vect(accu,tail...);
102 any_t(
const T& t) : val(new internal::Value<T>(t)), is_tuple(false) {}
104 any_t() : val(nullptr), is_tuple(false) {}
106 template<
typename H,
typename... T>
107 any_t(
const H& head,
const T&... tail)
108 : val(new internal::Value<std::list<
any_t>>({})),
114 add_to_vect(test.val, head, tail...);
117 any_t(
const char *s) : val(new internal::Value<std::string>(s)), is_tuple(false) {}
119 any_t(
const any_t& a) : val(a.val->clone()), is_tuple(a.is_tuple) {}
122 if(&t==
this)
return *
this;
130 return val->
less(*(a.val));
135 return val->
equal(*(a.val));
139 return !val->
equal(*(a.val));
143 return !val->
less(*(a.val));
147 return val->
equal(*(a.val)) || val->
less(*(a.val));
151 return !val->
equal(*(a.val)) && !val->
less(*(a.val));
157 return internal::any_cast<T>(*
this);
172 std::ostream&
operator<< (std::ostream& o,
const any_t& a);
187 catch (
const std::bad_cast& e) {
188 std::stringstream ss;
189 ss <<
"Failed to extract content of "<< a <<
". "
190 <<
"Tried to cast it as a "
192 <<
" but is actually of type ";
204 catch(std::bad_cast& e) {
bool any_typeof(const any_t &a)
Definition: any.hh:198
T any_cast(const any_t &a)
Definition: any.hh:181
std::ostream & operator<<(std::ostream &o, automaton_t aut)
static std::string demangle(const char *name)
Definition: demangle.hxx:48
Main namespace of Awali.
Definition: ato.hh:22
any_cast_exception(const std::string &s)
Definition: any.hh:175
Structure used to erase the type of labels/weights at the dyn layer.
Definition: any.hh:52
bool operator!=(const any_t &a) const
Definition: any.hh:138
bool operator<=(const any_t &a) const
Definition: any.hh:146
any_t()
Definition: any.hh:104
bool operator<(const any_t &a) const
Definition: any.hh:129
bool operator>(const any_t &a) const
Definition: any.hh:150
any_t & operator=(const any_t &t)
Definition: any.hh:121
std::ostream & real_type_id(std::ostream &o) const
Definition: any.hh:160
any_t(const H &head, const T &... tail)
Definition: any.hh:107
~any_t()
Definition: any.hh:167
bool operator>=(const any_t &a) const
Definition: any.hh:142
std::ostream & real_type_name(std::ostream &o) const
Definition: any.hh:163
any_t(const T &t)
Definition: any.hh:102
bool operator==(const any_t &a) const
Definition: any.hh:134
any_t(const char *s)
Definition: any.hh:117
friend std::ostream & operator<<(std::ostream &o, const dyn::any_t &a)
any_t(const any_t &a)
Definition: any.hh:119
T val
Definition: value.hh:33
Definition: untyped_value.hh:26
virtual bool equal(const untyped_value &uv) const =0
virtual bool less(const untyped_value &uv) const =0
virtual std::ostream & real_type_name(std::ostream &o) const =0
virtual std::ostream & real_type_id(std::ostream &o) const =0
virtual untyped_value * clone() const =0
virtual std::ostream & output(std::ostream &o) const =0