# C++ skeleton for Bison
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/// Empty construction.
variant ()]b4_parse_assert_if([
- : yytname_ (YY_NULL)])[
+ : yytypeid_ (YY_NULLPTR)])[
{}
/// Construct and fill.
template <typename T>
variant (const T& t)]b4_parse_assert_if([
- : yytname_ (typeid (T).name ())])[
+ : yytypeid_ (&typeid (T))])[
{
YYASSERT (sizeof (T) <= S);
new (yyas_<T> ()) T (t);
/// Destruction, allowed only if empty.
~variant ()
{]b4_parse_assert_if([
- YYASSERT (!yytname_);
+ YYASSERT (!yytypeid_);
])[}
/// Instantiate an empty \a T in here.
T&
build ()
{]b4_parse_assert_if([
- YYASSERT (!yytname_);
+ YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S);
- yytname_ = typeid (T).name ();])[
+ yytypeid_ = & typeid (T);])[
return *new (yyas_<T> ()) T;
}
T&
build (const T& t)
{]b4_parse_assert_if([
- YYASSERT (!yytname_);
+ YYASSERT (!yytypeid_);
YYASSERT (sizeof (T) <= S);
- yytname_ = typeid (T).name ();])[
+ yytypeid_ = & typeid (T);])[
return *new (yyas_<T> ()) T (t);
}
T&
as ()
{]b4_parse_assert_if([
- YYASSERT (yytname_ == typeid (T).name ());
+ YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> ();
}
const T&
as () const
{]b4_parse_assert_if([
- YYASSERT (yytname_ == typeid (T).name ());
+ YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (sizeof (T) <= S);])[
return *yyas_<T> ();
}
void
swap (self_type& other)
{]b4_parse_assert_if([
- YYASSERT (yytname_);
- YYASSERT (yytname_ == other.yytname_);])[
+ YYASSERT (yytypeid_);
+ YYASSERT (*yytypeid_ == *other.yytypeid_);])[
std::swap (as<T> (), other.as<T> ());
}
destroy ()
{
as<T> ().~T ();]b4_parse_assert_if([
- yytname_ = YY_NULL;])[
+ yytypeid_ = YY_NULLPTR;])[
}
private:
} yybuffer_;]b4_parse_assert_if([
/// Whether the content is built: if defined, the name of the stored type.
- const char *yytname_;])[
+ const std::type_info *yytypeid_;])[
};
]])
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
b4_symbol_if([$1], [has_type], [v]),
b4_locations_if([l])));
-
}
])])])