inline T&
build ()
{]b4_parse_assert_if([
- YYASSERT (!built);
- YYASSERT (!tname);
+ //YYASSERT (!built);
+ //YYASSERT (!tname);
YYASSERT (sizeof (T) <= S);
built = true;
tname = typeid (T).name ();])[
inline T&
build (const T& t)
{]b4_parse_assert_if([
- YYASSERT (!built);
- YYASSERT (!tname);
+ //YYASSERT (!built);
+ //YYASSERT (!tname);
YYASSERT (sizeof (T) <= S);
built = true;
tname = typeid (T).name ();])[
}
/// Swap the content with \a other, of same type.
+ /// Both variants must be built beforehand.
template <typename T>
inline void
swap (variant<S>& other)
{]b4_parse_assert_if([
+ YYASSERT (built);
+ YYASSERT (other.built);
YYASSERT (tname == other.tname);])[
- std::swap (as<T>(), other.as<T>());]b4_parse_assert_if([
- std::swap (built, other.built);
- std::swap (tname, other.tname);])[
+ std::swap (as<T>(), other.as<T>());
}
/// Assign the content of \a other to this.
abort ();
}
+ variant (const self_type&)
+ {
+ abort ();
+ }
+
private:
/// A buffer large enough to store any of the semantic values.
/// Long double is chosen as it has the strongest alignment