Skip to content

Commit

Permalink
LWG-2774 std::function construction vs assignment (#2098)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
sam20908 and StephanTLavavej authored Dec 17, 2021
1 parent 2f9f567 commit 990576e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions stl/inc/functional
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,9 @@ public:

protected:
template <class _Fx, class _Function>
using _Enable_if_callable_t =
enable_if_t<conjunction_v<negation<is_same<decay_t<_Fx>, _Function>>, _Is_invocable_r<_Ret, _Fx, _Types...>>,
int>;
using _Enable_if_callable_t = enable_if_t<conjunction_v<negation<is_same<_Remove_cvref_t<_Fx>, _Function>>,
_Is_invocable_r<_Ret, decay_t<_Fx>&, _Types...>>,
int>;

bool _Empty() const noexcept {
return !_Getimpl();
Expand Down Expand Up @@ -1045,12 +1045,12 @@ public:
}

#if _USE_FUNCTION_INT_0_SFINAE
template <class _Fx, typename _Mybase::template _Enable_if_callable_t<_Fx&, function> = 0>
template <class _Fx, typename _Mybase::template _Enable_if_callable_t<_Fx, function> = 0>
#else // ^^^ _USE_FUNCTION_INT_0_SFINAE // !_USE_FUNCTION_INT_0_SFINAE vvv
template <class _Fx, class = typename _Mybase::template _Enable_if_callable_t<_Fx&, function>>
template <class _Fx, class = typename _Mybase::template _Enable_if_callable_t<_Fx, function>>
#endif // _USE_FUNCTION_INT_0_SFINAE
function(_Fx _Func) {
this->_Reset(_STD move(_Func));
function(_Fx&& _Func) {
this->_Reset(_STD forward<_Fx>(_Func));
}

#if _HAS_FUNCTION_ALLOCATOR_SUPPORT
Expand All @@ -1066,12 +1066,12 @@ public:
}

#if _USE_FUNCTION_INT_0_SFINAE
template <class _Fx, class _Alloc, typename _Mybase::template _Enable_if_callable_t<_Fx&, function> = 0>
template <class _Fx, class _Alloc, typename _Mybase::template _Enable_if_callable_t<_Fx, function> = 0>
#else // ^^^ _USE_FUNCTION_INT_0_SFINAE // !_USE_FUNCTION_INT_0_SFINAE vvv
template <class _Fx, class _Alloc, class = typename _Mybase::template _Enable_if_callable_t<_Fx&, function>>
template <class _Fx, class _Alloc, class = typename _Mybase::template _Enable_if_callable_t<_Fx, function>>
#endif // _USE_FUNCTION_INT_0_SFINAE
function(allocator_arg_t, const _Alloc& _Ax, _Fx _Func) {
this->_Reset_alloc(_STD move(_Func), _Ax);
function(allocator_arg_t, const _Alloc& _Ax, _Fx&& _Func) {
this->_Reset_alloc(_STD forward<_Fx>(_Func), _Ax);
}
#endif // _HAS_FUNCTION_ALLOCATOR_SUPPORT

Expand Down Expand Up @@ -1100,9 +1100,9 @@ public:
}

#if _USE_FUNCTION_INT_0_SFINAE
template <class _Fx, typename _Mybase::template _Enable_if_callable_t<decay_t<_Fx>&, function> = 0>
template <class _Fx, typename _Mybase::template _Enable_if_callable_t<_Fx, function> = 0>
#else // ^^^ _USE_FUNCTION_INT_0_SFINAE // !_USE_FUNCTION_INT_0_SFINAE vvv
template <class _Fx, class = typename _Mybase::template _Enable_if_callable_t<decay_t<_Fx>&, function>>
template <class _Fx, class = typename _Mybase::template _Enable_if_callable_t<_Fx, function>>
#endif // _USE_FUNCTION_INT_0_SFINAE
function& operator=(_Fx&& _Func) {
function(_STD forward<_Fx>(_Func)).swap(*this);
Expand Down

0 comments on commit 990576e

Please sign in to comment.