diff options
| author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-19 23:42:55 +0000 |
|---|---|---|
| committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-19 23:42:55 +0000 |
| commit | 7b7a94fa2ca372bbd70e38711571386ec4d61e04 (patch) | |
| tree | c75d5146bb87cbb6490b36276caa5a46692e2159 /libstdc++-v3/include | |
| parent | ce30fba1942802086f27cc29c4ec62c23eaff3f2 (diff) | |
| download | gcc-7b7a94fa2ca372bbd70e38711571386ec4d61e04.tar.gz | |
PR libstdc++/55861
* include/std/future (_State_base::_S_check(const shared_ptr<T>&)):
Fix return type.
(__basic_future::_M_get_result()): Const qualify.
(shared_future::get()): Likewise.
* testsuite/30_threads/shared_future/members/get.cc: Use const
objects.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195314 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
| -rw-r--r-- | libstdc++-v3/include/std/future | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 2ecf438fc1e..6cccd3d3f2a 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -1,6 +1,6 @@ // <future> -*- C++ -*- -// Copyright (C) 2009-2012 Free Software Foundation, Inc. +// Copyright (C) 2009-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -447,7 +447,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __setter(promise<void>* __prom); template<typename _Tp> - static bool + static void _S_check(const shared_ptr<_Tp>& __p) { if (!static_cast<bool>(__p)) @@ -583,7 +583,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION protected: /// Wait for the state to be ready and rethrow any stored exception __result_type - _M_get_result() + _M_get_result() const { _State_base::_S_check(_M_state); _Result_base& __res = _M_state->wait(); @@ -794,12 +794,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Retrieving the value const _Res& - get() - { - typename _Base_type::__result_type __r = this->_M_get_result(); - _Res& __rs(__r._M_value()); - return __rs; - } + get() const { return this->_M_get_result()._M_value(); } }; /// Partial specialization for shared_future<R&> @@ -838,7 +833,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Retrieving the value _Res& - get() { return this->_M_get_result()._M_get(); } + get() const { return this->_M_get_result()._M_get(); } }; /// Explicit specialization for shared_future<void> @@ -877,7 +872,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Retrieving the value void - get() { this->_M_get_result(); } + get() const { this->_M_get_result(); } }; // Now we can define the protected __basic_future constructors. |
