Implement LWG2556: Wide contract for future::share()

llvm-svn: 292992
This commit is contained in:
Marshall Clow 2017-01-24 23:28:25 +00:00
parent 73edb6d0cc
commit 3cd9e94241
3 changed files with 16 additions and 10 deletions

View File

@ -156,7 +156,7 @@ public:
~future(); ~future();
future& operator=(const future& rhs) = delete; future& operator=(const future& rhs) = delete;
future& operator=(future&&) noexcept; future& operator=(future&&) noexcept;
shared_future<R> share(); shared_future<R> share() noecept;
// retrieving the value // retrieving the value
R get(); R get();
@ -183,7 +183,7 @@ public:
~future(); ~future();
future& operator=(const future& rhs) = delete; future& operator=(const future& rhs) = delete;
future& operator=(future&&) noexcept; future& operator=(future&&) noexcept;
shared_future<R&> share(); shared_future<R&> share() noexcept;
// retrieving the value // retrieving the value
R& get(); R& get();
@ -210,7 +210,7 @@ public:
~future(); ~future();
future& operator=(const future& rhs) = delete; future& operator=(const future& rhs) = delete;
future& operator=(future&&) noexcept; future& operator=(future&&) noexcept;
shared_future<void> share(); shared_future<void> share() noexcept;
// retrieving the value // retrieving the value
void get(); void get();
@ -1119,7 +1119,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future(); ~future();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
shared_future<_Rp> share(); shared_future<_Rp> share() _NOEXCEPT;
// retrieving the value // retrieving the value
_Rp get(); _Rp get();
@ -1222,7 +1222,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future(); ~future();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
shared_future<_Rp&> share(); shared_future<_Rp&> share() _NOEXCEPT;
// retrieving the value // retrieving the value
_Rp& get(); _Rp& get();
@ -1320,7 +1320,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future(); ~future();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
shared_future<void> share(); shared_future<void> share() _NOEXCEPT;
// retrieving the value // retrieving the value
void get(); void get();
@ -2580,7 +2580,7 @@ swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
template <class _Rp> template <class _Rp>
inline inline
shared_future<_Rp> shared_future<_Rp>
future<_Rp>::share() future<_Rp>::share() _NOEXCEPT
{ {
return shared_future<_Rp>(_VSTD::move(*this)); return shared_future<_Rp>(_VSTD::move(*this));
} }
@ -2588,7 +2588,7 @@ future<_Rp>::share()
template <class _Rp> template <class _Rp>
inline inline
shared_future<_Rp&> shared_future<_Rp&>
future<_Rp&>::share() future<_Rp&>::share() _NOEXCEPT
{ {
return shared_future<_Rp&>(_VSTD::move(*this)); return shared_future<_Rp&>(_VSTD::move(*this));
} }
@ -2597,7 +2597,7 @@ future<_Rp&>::share()
inline inline
shared_future<void> shared_future<void>
future<void>::share() future<void>::share() _NOEXCEPT
{ {
return shared_future<void>(_VSTD::move(*this)); return shared_future<void>(_VSTD::move(*this));
} }

View File

@ -25,6 +25,7 @@ int main()
typedef int T; typedef int T;
std::promise<T> p; std::promise<T> p;
std::future<T> f0 = p.get_future(); std::future<T> f0 = p.get_future();
static_assert( noexcept(f0.share()), "");
std::shared_future<T> f = std::move(f0.share()); std::shared_future<T> f = std::move(f0.share());
assert(!f0.valid()); assert(!f0.valid());
assert(f.valid()); assert(f.valid());
@ -32,6 +33,7 @@ int main()
{ {
typedef int T; typedef int T;
std::future<T> f0; std::future<T> f0;
static_assert( noexcept(f0.share()), "");
std::shared_future<T> f = std::move(f0.share()); std::shared_future<T> f = std::move(f0.share());
assert(!f0.valid()); assert(!f0.valid());
assert(!f.valid()); assert(!f.valid());
@ -40,6 +42,7 @@ int main()
typedef int& T; typedef int& T;
std::promise<T> p; std::promise<T> p;
std::future<T> f0 = p.get_future(); std::future<T> f0 = p.get_future();
static_assert( noexcept(f0.share()), "");
std::shared_future<T> f = std::move(f0.share()); std::shared_future<T> f = std::move(f0.share());
assert(!f0.valid()); assert(!f0.valid());
assert(f.valid()); assert(f.valid());
@ -47,6 +50,7 @@ int main()
{ {
typedef int& T; typedef int& T;
std::future<T> f0; std::future<T> f0;
static_assert( noexcept(f0.share()), "");
std::shared_future<T> f = std::move(f0.share()); std::shared_future<T> f = std::move(f0.share());
assert(!f0.valid()); assert(!f0.valid());
assert(!f.valid()); assert(!f.valid());
@ -55,6 +59,7 @@ int main()
typedef void T; typedef void T;
std::promise<T> p; std::promise<T> p;
std::future<T> f0 = p.get_future(); std::future<T> f0 = p.get_future();
static_assert( noexcept(f0.share()), "");
std::shared_future<T> f = std::move(f0.share()); std::shared_future<T> f = std::move(f0.share());
assert(!f0.valid()); assert(!f0.valid());
assert(f.valid()); assert(f.valid());
@ -62,6 +67,7 @@ int main()
{ {
typedef void T; typedef void T;
std::future<T> f0; std::future<T> f0;
static_assert( noexcept(f0.share()), "");
std::shared_future<T> f = std::move(f0.share()); std::shared_future<T> f = std::move(f0.share());
assert(!f0.valid()); assert(!f0.valid());
assert(!f.valid()); assert(!f.valid());

View File

@ -356,7 +356,7 @@
<tr><td><a href="http://wg21.link/LWG2540">2540</a></td><td>unordered_multimap::insert hint iterator</td><td>Issaquah</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2540">2540</a></td><td>unordered_multimap::insert hint iterator</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2543">2543</a></td><td>LWG 2148 (hash support for enum types) seems under-specified</td><td>Issaquah</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2543">2543</a></td><td>LWG 2148 (hash support for enum types) seems under-specified</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2544">2544</a></td><td>istreambuf_iterator(basic_streambuf<charT, traits>* s) effects unclear when s is 0</td><td>Issaquah</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2544">2544</a></td><td>istreambuf_iterator(basic_streambuf<charT, traits>* s) effects unclear when s is 0</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2556">2556</a></td><td>Wide contract for future::share()</td><td>Issaquah</td><td>Patch ready</td></tr> <tr><td><a href="http://wg21.link/LWG2556">2556</a></td><td>Wide contract for future::share()</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2562">2562</a></td><td>Consistent total ordering of pointers by comparison functors</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2562">2562</a></td><td>Consistent total ordering of pointers by comparison functors</td><td>Issaquah</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2567">2567</a></td><td>Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraits</td><td>Issaquah</td><td>Complete</td></tr> <tr><td><a href="http://wg21.link/LWG2567">2567</a></td><td>Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraits</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2568">2568</a></td><td>[fund.ts.v2] Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraits</td><td>Issaquah</td><td></td></tr> <tr><td><a href="http://wg21.link/LWG2568">2568</a></td><td>[fund.ts.v2] Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraits</td><td>Issaquah</td><td></td></tr>