Support constructor with an argument.

This improves the "list" bench by 2%.

	* data/lalr1.cc (variant::build): Add an overloaded version with
	an argument.
	* tests/c++.at (AT_CHECK_VARIANT): Check it.
This commit is contained in:
Akim Demaille
2008-08-08 00:38:07 +02:00
parent 763074102b
commit e5eb92e794
3 changed files with 38 additions and 11 deletions

View File

@@ -247,6 +247,16 @@ dnl FIXME: This is wrong, we want computed header guards.
return *new (buffer) T;
}
/// Instantiate a \a T in here from \a t.
template <typename T>
inline T&
build(const T& t)
{]b4_assert_if([
assert(!built);
built = true;])[
return *new (buffer) T(t);
}
/// Accessor to a built \a T.
template <typename T>
inline T&