76 std::ostream& output (std::ostream& o)
const {
83 for (
auto it =l.val.begin(); it != l.val.end(); it++) {
99 void static add_to_vect(std::list<any_t>&accu,
const H& head) {
100 accu.emplace_back(head);
103 template <
typename H,
typename...T>
104 void static add_to_vect
105 (std::list<any_t>& accu,
const H& head,
const T&... tail)
107 add_to_vect(accu,head);
108 add_to_vect(accu,tail...);
113 any_t(
const T& t) : val(new internal::Value<T>(t)), is_tuple(false) {}
115 any_t() : val(nullptr), is_tuple(false) {}
117 template<
typename H,
typename... T>
118 any_t(
const H& head,
const T&... tail)
119 : val(new internal::Value<std::list<
any_t>>({})),
125 add_to_vect(test.val, head, tail...);
128 any_t(
const char *s) : val(new internal::Value<std::string>(s)), is_tuple(false) {}
130 any_t(
const any_t& a) : val(a.val->clone()), is_tuple(a.is_tuple) {}
133 if(&t==
this)
return *
this;
141 return val->
less(*(a.val));
146 return val->
equal(*(a.val));
150 return !val->
equal(*(a.val));
154 return !val->
less(*(a.val));
158 return val->
equal(*(a.val)) || val->
less(*(a.val));
162 return !val->
equal(*(a.val)) && !val->
less(*(a.val));
167 operator T() const & {
168 return internal::any_cast<T>(*
this);
174 return internal::any_move<T>(*
this);
189 std::ostream&
operator<< (std::ostream& o,
const any_t& a);
202 return std::move(test.
val);
204 catch (
const std::bad_cast& e) {
205 std::stringstream ss;
206 ss <<
"Failed to extract content of "<< a <<
". "
207 <<
"Tried to cast it as a "
209 <<
" but is actually of type ";
221 catch (
const std::bad_cast& e) {
222 std::stringstream ss;
223 ss <<
"Failed to extract content of "<< a <<
". "
224 <<
"Tried to cast it as a "
226 <<
" but is actually of type ";
238 catch (
const std::bad_cast& e) {
239 std::stringstream ss;
240 ss <<
"Failed to extract content of "<< a <<
". "
241 <<
"Tried to cast it as a "
243 <<
" but is actually of type ";
255 catch(std::bad_cast& e) {
bool any_typeof(const any_t &a)
Definition: any.hh:249
T any_move(any_t &a)
Definition: any.hh:198
T const & any_cref(const any_t &a)
Definition: any.hh:215
T any_cast(const any_t &a)
Definition: any.hh:232
std::ostream & operator<<(std::ostream &o, automaton_t aut)
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:192
Structure used to erase the type of labels/weights at the dyn layer.
Definition: any.hh:59
bool operator!=(const any_t &a) const
Definition: any.hh:149
bool operator<=(const any_t &a) const
Definition: any.hh:157
any_t()
Definition: any.hh:115
bool operator<(const any_t &a) const
Definition: any.hh:140
bool operator>(const any_t &a) const
Definition: any.hh:161
any_t & operator=(const any_t &t)
Definition: any.hh:132
std::ostream & real_type_id(std::ostream &o) const
Definition: any.hh:177
any_t(const H &head, const T &... tail)
Definition: any.hh:118
~any_t()
Definition: any.hh:184
bool operator>=(const any_t &a) const
Definition: any.hh:153
std::ostream & real_type_name(std::ostream &o) const
Definition: any.hh:180
any_t(const T &t)
Definition: any.hh:113
bool operator==(const any_t &a) const
Definition: any.hh:145
any_t(const char *s)
Definition: any.hh:128
friend std::ostream & operator<<(std::ostream &o, const dyn::any_t &a)
any_t(const any_t &a)
Definition: any.hh:130
T val
Definition: value.hh:34
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