Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion stl/inc/functional
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,13 @@ private:
};
#pragma warning(pop)

// TRANSITION, Visual Studio 2019 16.5 + CUDA
#if (defined(_MSC_VER) && _MSC_VER < 1925) || defined(__CUDACC__)
#define _USE_FUNCTION_INT_0_SFINAE 0
#else
#define _USE_FUNCTION_INT_0_SFINAE 1
#endif // (defined(_MSC_VER) && _MSC_VER < 1925) || defined(__CUDACC__)

// CLASS TEMPLATE _Func_class
template <class _Ret, class... _Types>
class _Func_class : public _Arg_types<_Types...> {
Expand Down Expand Up @@ -976,7 +983,8 @@ 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...>>>;
enable_if_t<conjunction_v<negation<is_same<decay_t<_Fx>, _Function>>, _Is_invocable_r<_Ret, _Fx, _Types...>>,
int>;

bool _Empty() const noexcept {
return !_Getimpl();
Expand Down Expand Up @@ -1125,7 +1133,11 @@ public:
this->_Reset_copy(_Right);
}

#if _USE_FUNCTION_INT_0_SFINAE
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>>
#endif // _USE_FUNCTION_INT_0_SFINAE
function(_Fx _Func) {
this->_Reset(_STD move(_Func));
}
Expand All @@ -1142,7 +1154,11 @@ public:
this->_Reset_alloc(_Right, _Ax);
}

#if _USE_FUNCTION_INT_0_SFINAE
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>>
#endif // _USE_FUNCTION_INT_0_SFINAE
function(allocator_arg_t, const _Alloc& _Ax, _Fx _Func) {
this->_Reset_alloc(_STD move(_Func), _Ax);
}
Expand Down Expand Up @@ -1172,7 +1188,11 @@ public:
return *this;
}

#if _USE_FUNCTION_INT_0_SFINAE
template <class _Fx, typename _Mybase::template _Enable_if_callable_t<decay_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>>
#endif // _USE_FUNCTION_INT_0_SFINAE
function& operator=(_Fx&& _Func) {
function(_STD forward<_Fx>(_Func)).swap(*this);
return *this;
Expand Down