Merge branch 'develop' into feature/documentation

This commit is contained in:
Peter Dimov
2019-05-12 02:21:12 +03:00
4 changed files with 71 additions and 258 deletions

View File

@@ -1437,8 +1437,7 @@ there is exactly one occurrence of <code>U</code> in <code>T&#8230;&#8203;</code
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>constexpr variant&amp; operator=( const variant&amp; r )
noexcept( mp_all&lt;std::is_nothrow_copy_constructible&lt;T&gt;...,
std::is_nothrow_copy_assignable&lt;T&gt;...&gt;::value );</code></pre>
noexcept( mp_all&lt;std::is_nothrow_copy_constructible&lt;T&gt;...&gt;::value );</code></pre>
</div>
</div>
<div class="ulist none">
@@ -1452,17 +1451,7 @@ there is exactly one occurrence of <code>U</code> in <code>T&#8230;&#8203;</code
<dl>
<dt class="hdlist1">Effects: </dt>
<dd>
<div class="ulist">
<ul>
<li>
<p>If <code>index() == j</code>, assigns the value contained in <code>r</code> to the value
contained in <code>*this</code>.</p>
</li>
<li>
<p>Otherwise, equivalent to <code>emplace&lt;j&gt;(get&lt;j&gt;(r))</code>.</p>
</li>
</ul>
</div>
<p><code>emplace&lt;j&gt;(get&lt;j&gt;(r))</code>.</p>
</dd>
<dt class="hdlist1">Returns: </dt>
<dd>
@@ -1486,8 +1475,7 @@ contained in <code>*this</code>.</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>constexpr variant&amp; operator=( variant&amp;&amp; r )
noexcept( mp_all&lt;std::is_nothrow_move_constructible&lt;T&gt;...,
std::is_nothrow_move_assignable&lt;T&gt;...&gt;::value );</code></pre>
noexcept( mp_all&lt;std::is_nothrow_move_constructible&lt;T&gt;...&gt;::value );</code></pre>
</div>
</div>
<div class="ulist none">
@@ -1501,17 +1489,7 @@ contained in <code>*this</code>.</p>
<dl>
<dt class="hdlist1">Effects: </dt>
<dd>
<div class="ulist">
<ul>
<li>
<p>If <code>index() == j</code>, assigns the value contained in <code>std::move(r)</code> to the
value contained in <code>*this</code>.</p>
</li>
<li>
<p>Otherwise, equivalent to <code>emplace&lt;j&gt;(get&lt;j&gt;(std::move(r)))</code>.</p>
</li>
</ul>
</div>
<p><code>emplace&lt;j&gt;(get&lt;j&gt;(std::move(r)))</code>.</p>
</dd>
<dt class="hdlist1">Returns: </dt>
<dd>
@@ -1552,17 +1530,7 @@ alternative <code>Tj</code> which is the type of the contained value after const
<dl>
<dt class="hdlist1">Effects: </dt>
<dd>
<div class="ulist">
<ul>
<li>
<p>If <code>index() == j</code>, assigns <code>std::forward&lt;U&gt;(u)</code> to the value contained in
<code>*this</code>.</p>
</li>
<li>
<p>Otherwise, equivalent to <code>emplace&lt;j&gt;(std::forward&lt;U&gt;(u))</code>.</p>
</li>
</ul>
</div>
<p><code>emplace&lt;j&gt;(std::forward&lt;U&gt;(u))</code>.</p>
</dd>
<dt class="hdlist1">Returns: </dt>
<dd>
@@ -1574,8 +1542,7 @@ alternative <code>Tj</code> which is the type of the contained value after const
</dd>
<dt class="hdlist1">Remarks: </dt>
<dd>
<p>The expression inside <code>noexcept</code> is <code>std::is_nothrow_constructible_v&lt;Tj, U&gt;
&amp;&amp; std::is_nothrow_assignable_v&lt;Tj&amp;, U&gt;</code>.
<p>The expression inside <code>noexcept</code> is <code>std::is_nothrow_constructible_v&lt;Tj, U&amp;&amp;&gt;</code>.
This operator does not participate in overload resolution unless</p>
<div class="ulist">
<ul>
@@ -1583,7 +1550,7 @@ This operator does not participate in overload resolution unless</p>
<p><code>std::is_same_v&lt;std::remove_cvref_t&lt;T&gt;, variant&gt;</code> is <code>false</code>,</p>
</li>
<li>
<p><code>std::is_constructible_v&lt;Tj, U&gt; &amp;&amp; std::is_assignable_v&lt;Tj&amp;, U&gt;</code> is
<p><code>std::is_constructible_v&lt;Tj, U&amp;&amp;&gt; &amp;&amp; std::is_assignable_v&lt;Tj&amp;, U&amp;&amp;&gt;</code> is
<code>true</code>, and</p>
</li>
<li>
@@ -1623,7 +1590,7 @@ above-mentioned set of imaginary functions) is well-formed.</p>
<dt class="hdlist1">Remarks: </dt>
<dd>
<p>This function shall not participate in overload resolution unless
<code>std::is_constructible_v&lt;U, A&#8230;&#8203;&gt;</code> is <code>true</code> and <code>U</code> occurs exactly once
<code>std::is_constructible_v&lt;U, A&amp;&amp;&#8230;&#8203;&gt;</code> is <code>true</code> and <code>U</code> occurs exactly once
in <code>T&#8230;&#8203;</code>.</p>
</dd>
</dl>
@@ -1653,7 +1620,7 @@ in <code>T&#8230;&#8203;</code>.</p>
<dt class="hdlist1">Remarks: </dt>
<dd>
<p>This function shall not participate in overload resolution unless
<code>std::is_constructible_v&lt;U, std::initializer_list&lt;V&gt;&amp;, A&#8230;&#8203;&gt;</code> is <code>true</code>
<code>std::is_constructible_v&lt;U, std::initializer_list&lt;V&gt;&amp;, A&amp;&amp;&#8230;&#8203;&gt;</code> is <code>true</code>
and <code>U</code> occurs exactly once in <code>T&#8230;&#8203;</code>.</p>
</dd>
</dl>
@@ -1697,28 +1664,12 @@ value as if using the expression <code>Ti(std::forward&lt;A&gt;(a)&#8230;&#8203;
</dd>
<dt class="hdlist1">Exception Safety: </dt>
<dd>
<p>On exception:</p>
<div class="ulist">
<ul>
<li>
<p>If the list of alternatives contains <code>monostate</code>, the contained value
is either unchanged, or <code>monostate{}</code>;</p>
</li>
<li>
<p>Otherwise, if the list of alternatives contains types for which
<code>is_nothrow_default_constructible_v</code> is <code>true</code>, the contained value
is either unchanged, or <code>Tj{}</code>, where <code>Tj</code> is the first such alternative;</p>
</li>
<li>
<p>Otherwise, the contained value is unchanged.</p>
</li>
</ul>
</div>
<p>Strong. On exception, the contained value is unchanged.</p>
</dd>
<dt class="hdlist1">Remarks: </dt>
<dd>
<p>This function shall not participate in overload resolution unless
<code>std::is_constructible_v&lt;Ti, A&#8230;&#8203;&gt;</code> is <code>true</code>.</p>
<code>std::is_constructible_v&lt;Ti, A&amp;&amp;&#8230;&#8203;&gt;</code> is <code>true</code>.</p>
</dd>
</dl>
</div>
@@ -1761,28 +1712,12 @@ value as if using the expression <code>Ti(il, std::forward&lt;A&gt;(a)&#8230;&#8
</dd>
<dt class="hdlist1">Exception Safety: </dt>
<dd>
<p>On exception:</p>
<div class="ulist">
<ul>
<li>
<p>If the list of alternatives contains <code>monostate</code>, the contained value
is either unchanged, or <code>monostate{}</code>;</p>
</li>
<li>
<p>Otherwise, if the list of alternatives contains types for which
<code>is_nothrow_default_constructible_v</code> is <code>true</code>, the contained value
is either unchanged, or <code>Tj{}</code>, where <code>Tj</code> is the first such alternative;</p>
</li>
<li>
<p>Otherwise, the contained value is unchanged.</p>
</li>
</ul>
</div>
<p>Strong. On exception, the contained value is unchanged.</p>
</dd>
<dt class="hdlist1">Remarks: </dt>
<dd>
<p>This function shall not participate in overload resolution unless
<code>std::is_constructible_v&lt;Ti, std::initializer_list&lt;V&gt;&amp;, A&#8230;&#8203;&gt;</code> is <code>true</code>.</p>
<code>std::is_constructible_v&lt;Ti, std::initializer_list&lt;V&gt;&amp;, A&amp;&amp;&#8230;&#8203;&gt;</code> is <code>true</code>.</p>
</dd>
</dl>
</div>
@@ -1809,6 +1744,18 @@ is either unchanged, or <code>Tj{}</code>, where <code>Tj</code> is the first su
</dd>
</dl>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<div class="title">Note</div>
</td>
<td class="content">
This function is provided purely for compatibility with <code>std::variant</code>.
</td>
</tr>
</table>
</div>
</li>
</ul>
</div>
@@ -2519,7 +2466,7 @@ the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Versi
</div>
<div id="footer">
<div id="footer-text">
Last updated 2019-05-12 00:11:41 +0300
Last updated 2019-05-12 00:15:41 +0300
</div>
</div>
<style>

View File

@@ -390,18 +390,14 @@ Effects: ::
```
constexpr variant& operator=( const variant& r )
noexcept( mp_all<std::is_nothrow_copy_constructible<T>...,
std::is_nothrow_copy_assignable<T>...>::value );
noexcept( mp_all<std::is_nothrow_copy_constructible<T>...>::value );
```
[none]
* {blank}
+
Let `j` be `r.index()`.
Effects: ::
- If `index() == j`, assigns the value contained in `r` to the value
contained in `*this`.
- Otherwise, equivalent to `emplace<j>(get<j>(r))`.
Effects: :: `emplace<j>(get<j>(r))`.
Returns: :: `*this`.
Ensures: :: `index() == r.index()`.
Remarks: :: This operator does not participate in overload resolution unless
@@ -410,18 +406,14 @@ Remarks: :: This operator does not participate in overload resolution unless
```
constexpr variant& operator=( variant&& r )
noexcept( mp_all<std::is_nothrow_move_constructible<T>...,
std::is_nothrow_move_assignable<T>...>::value );
noexcept( mp_all<std::is_nothrow_move_constructible<T>...>::value );
```
[none]
* {blank}
+
Let `j` be `r.index()`.
Effects: ::
- If `index() == j`, assigns the value contained in `std::move(r)` to the
value contained in `*this`.
- Otherwise, equivalent to `emplace<j>(get<j>(std::move(r)))`.
Effects: :: `emplace<j>(get<j>(std::move(r)))`.
Returns: :: `*this`.
Ensures: :: `index() == r.index()`.
Remarks: :: This operator does not participate in overload resolution unless
@@ -440,18 +432,14 @@ Let `Tj` be a type that is determined as follows: build an imaginary function
overload resolution for the expression `FUN(std::forward<U>(u))` defines the
alternative `Tj` which is the type of the contained value after construction.
Effects: ::
- If `index() == j`, assigns `std::forward<U>(u)` to the value contained in
`*this`.
- Otherwise, equivalent to `emplace<j>(std::forward<U>(u))`.
Effects: :: `emplace<j>(std::forward<U>(u))`.
Returns: :: `*this`.
Ensures: :: `index() == j`.
Remarks: ::
The expression inside `noexcept` is `std::is_nothrow_constructible_v<Tj, U>
&& std::is_nothrow_assignable_v<Tj&, U>`.
The expression inside `noexcept` is `std::is_nothrow_constructible_v<Tj, U&&>`.
This operator does not participate in overload resolution unless
- `std::is_same_v<std::remove_cvref_t<T>, variant>` is `false`,
- `std::is_constructible_v<Tj, U> && std::is_assignable_v<Tj&, U>` is
- `std::is_constructible_v<Tj, U&&> && std::is_assignable_v<Tj&, U&&>` is
`true`, and
- the expression `FUN(std::forward<U>(u))` (with `FUN` being the
above-mentioned set of imaginary functions) is well-formed.
@@ -470,7 +458,7 @@ Let `I` be the zero-based index of `U` in `T...`.
Effects: :: Equivalent to: `return emplace<I>(std::forward<A>(a)...);`
Remarks: ::
This function shall not participate in overload resolution unless
`std::is_constructible_v<U, A...>` is `true` and `U` occurs exactly once
`std::is_constructible_v<U, A&&...>` is `true` and `U` occurs exactly once
in `T...`.
```
@@ -485,7 +473,7 @@ Let `I` be the zero-based index of `U` in `T...`.
Effects: :: Equivalent to: `return emplace<I>(il, std::forward<A>(a)...);`
Remarks: ::
This function shall not participate in overload resolution unless
`std::is_constructible_v<U, std::initializer_list<V>&, A...>` is `true`
`std::is_constructible_v<U, std::initializer_list<V>&, A&&...>` is `true`
and `U` occurs exactly once in `T...`.
@@ -505,16 +493,10 @@ Ensures: :: `index() == I`.
Returns: :: A reference to the new contained value.
Throws: ::
Nothing unless the initialization of the new contained value throws.
Exception Safety: :: On exception:
- If the list of alternatives contains `monostate`, the contained value
is either unchanged, or `monostate{}`;
- Otherwise, if the list of alternatives contains types for which
`is_nothrow_default_constructible_v` is `true`, the contained value
is either unchanged, or `Tj{}`, where `Tj` is the first such alternative;
- Otherwise, the contained value is unchanged.
Exception Safety: :: Strong. On exception, the contained value is unchanged.
Remarks: ::
This function shall not participate in overload resolution unless
`std::is_constructible_v<Ti, A...>` is `true`.
`std::is_constructible_v<Ti, A&&...>` is `true`.
```
template<size_t I, class V, class... A>
@@ -532,16 +514,10 @@ Ensures: :: `index() == I`.
Returns: :: A reference to the new contained value.
Throws: ::
Nothing unless the initialization of the new contained value throws.
Exception Safety: :: On exception:
- If the list of alternatives contains `monostate`, the contained value
is either unchanged, or `monostate{}`;
- Otherwise, if the list of alternatives contains types for which
`is_nothrow_default_constructible_v` is `true`, the contained value
is either unchanged, or `Tj{}`, where `Tj` is the first such alternative;
- Otherwise, the contained value is unchanged.
Exception Safety: :: Strong. On exception, the contained value is unchanged.
Remarks: ::
This function shall not participate in overload resolution unless
`std::is_constructible_v<Ti, std::initializer_list<V>&, A...>` is `true`.
`std::is_constructible_v<Ti, std::initializer_list<V>&, A&&...>` is `true`.
#### Value Status
@@ -553,6 +529,8 @@ constexpr bool valueless_by_exception() const noexcept;
+
Returns: :: `false`.
NOTE: This function is provided purely for compatibility with `std::variant`.
```
constexpr size_t index() const noexcept;
```

View File

@@ -598,11 +598,8 @@ template<class U, class... T> using resolve_overload_index = mp11::mp_find<mp11:
// variant_base
template<class... T> using can_be_valueless = mp11::mp_any<std::is_same<T, monostate>..., std::is_nothrow_default_constructible<T>...>;
template<class... T> using valueless_index = mp11::mp_if<mp11::mp_contains<mp11::mp_list<T...>, monostate>, mp11::mp_find<mp11::mp_list<T...>, monostate>, mp11::mp_find_if<mp11::mp_list<T...>, std::is_nothrow_default_constructible>>;
template<bool is_trivially_destructible, bool is_single_buffered, class... T> struct variant_base_impl; // trivially destructible, single buffered
template<class... T> using variant_base = variant_base_impl<mp11::mp_all<std::is_trivially_destructible<T>...>::value, mp11::mp_any<mp11::mp_all<std::is_nothrow_move_constructible<T>...>, can_be_valueless<T...>>::value, T...>;
template<bool is_trivially_destructible, bool is_single_buffered, class... T> struct variant_base_impl;
template<class... T> using variant_base = variant_base_impl<mp11::mp_all<std::is_trivially_destructible<T>...>::value, mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value, T...>;
struct none {};
@@ -649,7 +646,7 @@ template<class... T> struct variant_base_impl<true, true, T...>
return st1_.get( mp11::mp_size_t<I+1>() );
}
template<std::size_t J, class U, bool B, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, mp11::mp_bool<B>, A&&... a )
template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, A&&... a )
{
static_assert( std::is_nothrow_constructible<U, A&&...>::value, "Logic error: U must be nothrow constructible from A&&..." );
@@ -657,7 +654,7 @@ template<class... T> struct variant_base_impl<true, true, T...>
ix_ = J;
}
template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_true, A&&... a )
template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, A&&... a )
{
static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" );
@@ -667,37 +664,12 @@ template<class... T> struct variant_base_impl<true, true, T...>
ix_ = J;
}
template<std::size_t J, class U, class... A> void emplace_impl( mp11::mp_false, mp11::mp_false, A&&... a )
{
static_assert( can_be_valueless<T...>::value, "Logic error: T... must have a fallback type" );
std::size_t const K = valueless_index<T...>::value;
static_assert( K < sizeof...(T), "Logic error: T... must have a fallback index" );
try
{
st1_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... );
ix_ = J;
}
catch( ... )
{
st1_.emplace( mp11::mp_size_t<K+1>() );
ix_ = K+1;
throw;
}
}
template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a )
{
std::size_t const J = I+1;
using U = mp11::mp_at_c<variant<T...>, I>;
constexpr bool B1 = can_be_valueless<T...>::value;
constexpr bool B2 = mp11::mp_all<detail::is_trivially_move_constructible<U>, detail::is_trivially_move_assignable<T>...>::value;
this->emplace_impl<J, U>( std::is_nothrow_constructible<U, A&&...>(), mp11::mp_bool<B2 || !B1>(), std::forward<A>(a)... );
this->emplace_impl<J, U>( std::is_nothrow_constructible<U, A&&...>(), std::forward<A>(a)... );
}
};
@@ -836,42 +808,12 @@ template<class... T> struct variant_base_impl<false, true, T...>
return st1_.get( mp11::mp_size_t<I+1>() );
}
template<std::size_t J, class U, class... A> void emplace_impl( mp11::mp_int<0>, A&&... a )
template<std::size_t I, class... A> void emplace( A&&... a )
{
static_assert( std::is_nothrow_constructible<U, A&&...>::value, "Logic error: U must be nothrow constructible from A&&..." );
size_t const J = I+1;
_destroy();
using U = mp11::mp_at_c<variant<T...>, I>;
st1_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... );
ix_ = J;
}
template<std::size_t J, class U, class... A> void emplace_impl( mp11::mp_int<1>, A&&... a )
{
static_assert( can_be_valueless<T...>::value, "Logic error: T... must have a fallback type" );
std::size_t const K = valueless_index<T...>::value;
static_assert( K < sizeof...(T), "Logic error: T... must have a fallback index" );
_destroy();
try
{
st1_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... );
ix_ = J;
}
catch( ... )
{
st1_.emplace( mp11::mp_size_t<K+1>() );
ix_ = K+1;
throw;
}
}
template<std::size_t J, class U, class... A> void emplace_impl( mp11::mp_int<2>, A&&... a )
{
static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" );
U tmp( std::forward<A>(a)... );
@@ -881,17 +823,6 @@ template<class... T> struct variant_base_impl<false, true, T...>
st1_.emplace( mp11::mp_size_t<J>(), std::move(tmp) );
ix_ = J;
}
template<std::size_t I, class... A> void emplace( A&&... a )
{
size_t const J = I+1;
using U = mp11::mp_at_c<variant<T...>, I>;
int const D = std::is_nothrow_constructible<U, A&&...>::value? 0: ( can_be_valueless<T...>::value? 1: 2 );
this->emplace_impl<J, U>( mp11::mp_int<D>(), std::forward<A>(a)... );
}
};
// not trivially destructible, double buffered
@@ -1237,14 +1168,7 @@ private:
template<class I> void operator()( I i ) const
{
if( this_->index() == i )
{
this_->_get_impl( i ) = r._get_impl( i );
}
else
{
this_->variant_base::template emplace<I::value>( r._get_impl( i ) );
}
this_->variant_base::template emplace<I::value>( r._get_impl( i ) );
}
};
@@ -1255,7 +1179,7 @@ public:
class E3 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<T>..., std::is_copy_assignable<T>...>, E1>
>
BOOST_CXX14_CONSTEXPR variant& operator=( variant const & r )
noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>..., std::is_nothrow_copy_assignable<T>...>::value )
noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>...>::value )
{
mp11::mp_with_index<sizeof...(T)>( r.index(), L3{ this, r } );
return *this;
@@ -1279,14 +1203,7 @@ private:
template<class I> void operator()( I i ) const
{
if( this_->index() == i )
{
this_->_get_impl( i ) = std::move( r._get_impl( i ) );
}
else
{
this_->variant_base::template emplace<I::value>( std::move( r._get_impl( i ) ) );
}
this_->variant_base::template emplace<I::value>( std::move( r._get_impl( i ) ) );
}
};
@@ -1297,7 +1214,7 @@ public:
class E3 = mp11::mp_if<mp11::mp_all<std::is_move_constructible<T>..., std::is_move_assignable<T>...>, E1>
>
variant& operator=( variant && r )
noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>..., std::is_nothrow_move_assignable<T>...>::value )
noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value )
{
mp11::mp_with_index<sizeof...(T)>( r.index(), L4{ this, r } );
return *this;
@@ -1309,19 +1226,10 @@ public:
class E2 = typename std::enable_if<std::is_assignable<V&, U&&>::value && std::is_constructible<V, U&&>::value>::type
>
BOOST_CXX14_CONSTEXPR variant& operator=( U&& u )
noexcept( std::is_nothrow_assignable<V&, U&&>::value && std::is_nothrow_constructible<V, U&&>::value )
noexcept( std::is_nothrow_constructible<V, U&&>::value )
{
std::size_t const I = detail::resolve_overload_index<U, T...>::value;
if( index() == I )
{
_get_impl( mp11::mp_size_t<I>() ) = std::forward<U>(u);
}
else
{
this->template emplace<I>( std::forward<U>(u) );
}
this->template emplace<I>( std::forward<U>(u) );
return *this;
}

View File

@@ -115,8 +115,8 @@ int main()
}
catch( std::exception const& )
{
// basic guarantee; X1 is nothrow default-constructible
BOOST_TEST_EQ( v.index(), 1 );
// strong guarantee
BOOST_TEST_EQ( v.index(), 0 );
}
}
@@ -132,8 +132,8 @@ int main()
}
catch( std::exception const& )
{
// basic guarantee; X1 is nothrow default-constructible
BOOST_TEST_EQ( v.index(), 0 );
// strong guarantee
BOOST_TEST_EQ( v.index(), 1 );
}
}
@@ -149,8 +149,8 @@ int main()
}
catch( std::exception const& )
{
// basic guarantee; monostate
BOOST_TEST_EQ( v.index(), 2 );
// strong guarantee
BOOST_TEST_EQ( v.index(), 0 );
}
}
@@ -166,8 +166,8 @@ int main()
}
catch( std::exception const& )
{
// basic guarantee; monostate
BOOST_TEST_EQ( v.index(), 2 );
// strong guarantee
BOOST_TEST_EQ( v.index(), 1 );
}
}
@@ -183,8 +183,8 @@ int main()
}
catch( std::exception const& )
{
// basic guarantee; X1 is nothrow default-constructible
BOOST_TEST_EQ( v.index(), 2 );
// strong guarantee
BOOST_TEST_EQ( v.index(), 0 );
}
}
@@ -200,8 +200,8 @@ int main()
}
catch( std::exception const& )
{
// basic guarantee; monostate
BOOST_TEST_EQ( v.index(), 3 );
// strong guarantee
BOOST_TEST_EQ( v.index(), 0 );
}
}
@@ -234,18 +234,8 @@ int main()
}
catch( std::exception const& )
{
// X3 is not v2d::trivially_move_assignable on libstdc++ 4.x
if( v2d::is_trivially_move_assignable<X3>::value )
{
// all trivially destructible and move-assignable, no change
BOOST_TEST_EQ( v.index(), 0 );
}
else
{
// basic guarantee; X1 is nothrow default-constructible
BOOST_TEST_EQ( v.index(), 1 );
}
// strong guarantee
BOOST_TEST_EQ( v.index(), 0 );
}
}
@@ -261,18 +251,8 @@ int main()
}
catch( std::exception const& )
{
// X3 is not v2d::trivially_move_assignable on libstdc++ 4.x
if( v2d::is_trivially_move_assignable<X3>::value )
{
// all trivially destructible and move-assignable, no change
BOOST_TEST_EQ( v.index(), 0 );
}
else
{
// basic guarantee; monostate
BOOST_TEST_EQ( v.index(), 2 );
}
// strong guarantee
BOOST_TEST_EQ( v.index(), 0 );
}
}