mirror of git://gcc.gnu.org/git/gcc.git
LWG 3039 Unnecessary decay in thread and packaged_task
* include/std/future (__constrain_pkgdtask): Replace with ... (packaged_task::__not_same): New alias template, using __remove_cvref_t instead of decay. * include/std/thread (thread::__not_same): Add comment. From-SVN: r261618
This commit is contained in:
parent
024e96b90b
commit
cb4f9a8c05
|
|
@ -1,3 +1,11 @@
|
||||||
|
2018-06-15 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
LWG 3039 Unnecessary decay in thread and packaged_task
|
||||||
|
* include/std/future (__constrain_pkgdtask): Replace with ...
|
||||||
|
(packaged_task::__not_same): New alias template, using
|
||||||
|
__remove_cvref_t instead of decay.
|
||||||
|
* include/std/thread (thread::__not_same): Add comment.
|
||||||
|
|
||||||
2018-06-14 Jonathan Wakely <jwakely@redhat.com>
|
2018-06-14 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
LWG 3075 basic_string needs deduction guides from basic_string_view
|
LWG 3075 basic_string needs deduction guides from basic_string_view
|
||||||
|
|
|
||||||
|
|
@ -1462,15 +1462,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
static_cast<_Alloc&>(_M_impl));
|
static_cast<_Alloc&>(_M_impl));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Task, typename _Fn, bool
|
|
||||||
= is_same<_Task, typename decay<_Fn>::type>::value>
|
|
||||||
struct __constrain_pkgdtask
|
|
||||||
{ typedef void __type; };
|
|
||||||
|
|
||||||
template<typename _Task, typename _Fn>
|
|
||||||
struct __constrain_pkgdtask<_Task, _Fn, true>
|
|
||||||
{ };
|
|
||||||
|
|
||||||
/// packaged_task
|
/// packaged_task
|
||||||
template<typename _Res, typename... _ArgTypes>
|
template<typename _Res, typename... _ArgTypes>
|
||||||
class packaged_task<_Res(_ArgTypes...)>
|
class packaged_task<_Res(_ArgTypes...)>
|
||||||
|
|
@ -1478,6 +1469,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
typedef __future_base::_Task_state_base<_Res(_ArgTypes...)> _State_type;
|
typedef __future_base::_Task_state_base<_Res(_ArgTypes...)> _State_type;
|
||||||
shared_ptr<_State_type> _M_state;
|
shared_ptr<_State_type> _M_state;
|
||||||
|
|
||||||
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||||
|
// 3039. Unnecessary decay in thread and packaged_task
|
||||||
|
template<typename _Fn, typename _Fn2 = __remove_cvref_t<_Fn>>
|
||||||
|
using __not_same
|
||||||
|
= typename enable_if<!is_same<packaged_task, _Fn2>::value>::type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Construction and destruction
|
// Construction and destruction
|
||||||
packaged_task() noexcept { }
|
packaged_task() noexcept { }
|
||||||
|
|
@ -1488,8 +1485,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
packaged_task(allocator_arg_t, const _Allocator& __a) noexcept
|
packaged_task(allocator_arg_t, const _Allocator& __a) noexcept
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
template<typename _Fn, typename = typename
|
template<typename _Fn, typename = __not_same<_Fn>>
|
||||||
__constrain_pkgdtask<packaged_task, _Fn>::__type>
|
|
||||||
explicit
|
explicit
|
||||||
packaged_task(_Fn&& __fn)
|
packaged_task(_Fn&& __fn)
|
||||||
: packaged_task(allocator_arg, std::allocator<int>(),
|
: packaged_task(allocator_arg, std::allocator<int>(),
|
||||||
|
|
@ -1499,8 +1495,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||||
// 2097. packaged_task constructors should be constrained
|
// 2097. packaged_task constructors should be constrained
|
||||||
// 2407. [this constructor should not be] explicit
|
// 2407. [this constructor should not be] explicit
|
||||||
template<typename _Fn, typename _Alloc, typename = typename
|
template<typename _Fn, typename _Alloc, typename = __not_same<_Fn>>
|
||||||
__constrain_pkgdtask<packaged_task, _Fn>::__type>
|
|
||||||
packaged_task(allocator_arg_t, const _Alloc& __a, _Fn&& __fn)
|
packaged_task(allocator_arg_t, const _Alloc& __a, _Fn&& __fn)
|
||||||
: _M_state(__create_task_state<_Res(_ArgTypes...)>(
|
: _M_state(__create_task_state<_Res(_ArgTypes...)>(
|
||||||
std::forward<_Fn>(__fn), __a))
|
std::forward<_Fn>(__fn), __a))
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
|
|
||||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||||
// 2097. packaged_task constructors should be constrained
|
// 2097. packaged_task constructors should be constrained
|
||||||
|
// 3039. Unnecessary decay in thread and packaged_task
|
||||||
template<typename _Tp>
|
template<typename _Tp>
|
||||||
using __not_same = __not_<is_same<__remove_cvref_t<_Tp>, thread>>;
|
using __not_same = __not_<is_same<__remove_cvref_t<_Tp>, thread>>;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue