@@ -60,6 +60,7 @@ void cpprest_init(JavaVM*);
60
60
#include < algorithm>
61
61
62
62
#if defined(_MSC_VER)
63
+ #include < intrin.h>
63
64
#if defined(__cplusplus_winrt)
64
65
#include < windows.h>
65
66
#include < ctxtcall.h>
@@ -6698,7 +6699,7 @@ auto when_all(_Iterator _Begin, _Iterator _End, const task_options& _TaskOptions
6698
6699
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
6699
6700
/* */
6700
6701
template <typename _ReturnType>
6701
- task<std::vector<_ReturnType>> operator &&(const task<_ReturnType> & _Lhs, const task<_ReturnType> & _Rhs)
6702
+ auto operator &&(const task<_ReturnType> & _Lhs, const task<_ReturnType> & _Rhs)
6702
6703
{
6703
6704
task<_ReturnType> _PTasks[2 ] = {_Lhs, _Rhs};
6704
6705
return when_all (_PTasks, _PTasks+2 );
@@ -6730,7 +6731,7 @@ task<std::vector<_ReturnType>> operator&&(const task<_ReturnType> & _Lhs, const
6730
6731
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
6731
6732
/* */
6732
6733
template <typename _ReturnType>
6733
- task<std::vector<_ReturnType>> operator &&(const task<std::vector<_ReturnType>> & _Lhs, const task<_ReturnType> & _Rhs)
6734
+ auto operator &&(const task<std::vector<_ReturnType>> & _Lhs, const task<_ReturnType> & _Rhs)
6734
6735
{
6735
6736
return details::_WhenAllVectorAndValue (_Lhs, _Rhs, true );
6736
6737
}
@@ -6761,7 +6762,7 @@ task<std::vector<_ReturnType>> operator&&(const task<std::vector<_ReturnType>> &
6761
6762
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
6762
6763
/* */
6763
6764
template <typename _ReturnType>
6764
- task<std::vector<_ReturnType>> operator &&(const task<_ReturnType> & _Lhs, const task<std::vector<_ReturnType>> & _Rhs)
6765
+ auto operator &&(const task<_ReturnType> & _Lhs, const task<std::vector<_ReturnType>> & _Rhs)
6765
6766
{
6766
6767
return details::_WhenAllVectorAndValue (_Rhs, _Lhs, false );
6767
6768
}
@@ -6792,43 +6793,12 @@ task<std::vector<_ReturnType>> operator&&(const task<_ReturnType> & _Lhs, const
6792
6793
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
6793
6794
/* */
6794
6795
template <typename _ReturnType>
6795
- task<std::vector<_ReturnType>> operator &&(const task<std::vector<_ReturnType>> & _Lhs, const task<std::vector<_ReturnType>> & _Rhs)
6796
+ auto operator &&(const task<std::vector<_ReturnType>> & _Lhs, const task<std::vector<_ReturnType>> & _Rhs)
6796
6797
{
6797
6798
task<std::vector<_ReturnType>> _PTasks[2 ] = {_Lhs, _Rhs};
6798
6799
return when_all (_PTasks, _PTasks+2 );
6799
6800
}
6800
6801
6801
- // / <summary>
6802
- // / Creates a task that will complete succesfully when both of the tasks supplied as arguments complete successfully.
6803
- // / </summary>
6804
- // / <typeparam name="_ReturnType">
6805
- // / The type of the returned task.
6806
- // / </typeparam>
6807
- // / <param name="_Lhs">
6808
- // / The first task to combine into the resulting task.
6809
- // / </param>
6810
- // / <param name="_Rhs">
6811
- // / The second task to combine into the resulting task.
6812
- // / </param>
6813
- // / <returns>
6814
- // / A task that completes successfully when both of the input tasks have completed successfully. If the input tasks are of type <c>T</c>,
6815
- // / the output of this function will be a <c>task<std::vector<T>></c>. If the input tasks are of type <c>void</c> the output
6816
- // / task will also be a <c>task<void></c>.
6817
- // / <para> To allow for a construct of the sort taskA && taskB && taskC, which are combined in pairs, the && operator
6818
- // / produces a <c>task<std::vector<T>></c> if either one or both of the tasks are of type <c>task<std::vector<T>></c>.</para>
6819
- // / </returns>
6820
- // / <remarks>
6821
- // / If one of the tasks is canceled or throws an exception, the returned task will complete early, in the canceled state, and the exception,
6822
- // / if one is encoutered, will be thrown if you call <c>get()</c> or <c>wait()</c> on that task.
6823
- // / </remarks>
6824
- // / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
6825
- /* */
6826
- inline task<void > operator &&(const task<void > & _Lhs, const task<void > & _Rhs)
6827
- {
6828
- task<void > _PTasks[2 ] = {_Lhs, _Rhs};
6829
- return when_all (_PTasks, _PTasks+2 );
6830
- }
6831
-
6832
6802
namespace details
6833
6803
{
6834
6804
// Helper struct for when_any operators to know when tasks have completed
@@ -7114,7 +7084,7 @@ auto when_any(_Iterator _Begin, _Iterator _End, cancellation_token _Cancellation
7114
7084
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
7115
7085
/* */
7116
7086
template <typename _ReturnType>
7117
- task<_ReturnType> operator ||(const task<_ReturnType> & _Lhs, const task<_ReturnType> & _Rhs)
7087
+ auto operator ||(const task<_ReturnType> & _Lhs, const task<_ReturnType> & _Rhs)
7118
7088
{
7119
7089
auto _PParam = new details::_RunAnyParam<std::pair<_ReturnType, size_t >>();
7120
7090
@@ -7175,7 +7145,7 @@ task<_ReturnType> operator||(const task<_ReturnType> & _Lhs, const task<_ReturnT
7175
7145
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
7176
7146
/* */
7177
7147
template <typename _ReturnType>
7178
- task<std::vector<_ReturnType>> operator ||(const task<std::vector<_ReturnType>> & _Lhs, const task<_ReturnType> & _Rhs)
7148
+ auto operator ||(const task<std::vector<_ReturnType>> & _Lhs, const task<_ReturnType> & _Rhs)
7179
7149
{
7180
7150
auto _PParam = new details::_RunAnyParam<std::pair<std::vector<_ReturnType>, details::_CancellationTokenState *>>();
7181
7151
@@ -7249,7 +7219,7 @@ task<std::vector<_ReturnType>> operator||(const task<std::vector<_ReturnType>> &
7249
7219
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
7250
7220
/* */
7251
7221
template <typename _ReturnType>
7252
- task<std::vector<_ReturnType>> operator ||(const task<_ReturnType> & _Lhs, const task<std::vector<_ReturnType>> & _Rhs)
7222
+ auto operator ||(const task<_ReturnType> & _Lhs, const task<std::vector<_ReturnType>> & _Rhs)
7253
7223
{
7254
7224
return _Rhs || _Lhs;
7255
7225
}
@@ -7280,14 +7250,17 @@ task<std::vector<_ReturnType>> operator||(const task<_ReturnType> & _Lhs, const
7280
7250
// / </remarks>
7281
7251
// / <seealso cref="Task Parallelism (Concurrency Runtime)"/>
7282
7252
/* */
7283
- inline task<void > operator ||(const task<void > & _Lhs, const task<void > & _Rhs)
7253
+ template <typename _Ty = task<void >, typename _Pair = std::pair<details::_Unit_type, details::_CancellationTokenState *>>
7254
+ _Ty operator ||(const task<void > & _Lhs_arg, const task<void > & _Rhs_arg)
7284
7255
{
7285
- auto _PParam = new details::_RunAnyParam<std::pair<details::_Unit_type, details::_CancellationTokenState *>>();
7256
+ const _Ty& _Lhs = _Lhs_arg;
7257
+ const _Ty& _Rhs = _Rhs_arg;
7258
+ auto _PParam = new details::_RunAnyParam<_Pair>();
7286
7259
7287
7260
task<std::pair<details::_Unit_type, details::_CancellationTokenState *>> _Any_task_completed (_PParam->_M_Completed , _PParam->_M_cancellationSource .get_token ());
7288
7261
// Chain the return continuation task here to ensure it will get inline execution when _M_Completed.set is called,
7289
7262
// So that _PParam can be used before it getting deleted.
7290
- auto _ReturnTask = _Any_task_completed._Then ([=](std::pair<details::_Unit_type, details::_CancellationTokenState *> _Ret) {
7263
+ auto _ReturnTask = _Any_task_completed._Then ([=](_Pair _Ret) {
7291
7264
_ASSERTE (_Ret.second );
7292
7265
details::_JoinAllTokens_Add (_PParam->_M_cancellationSource , _Ret.second );
7293
7266
}, nullptr );
@@ -7298,7 +7271,7 @@ inline task<void> operator||(const task<void> & _Lhs, const task<void> & _Rhs)
7298
7271
}
7299
7272
7300
7273
_PParam->_M_numTasks = 2 ;
7301
- auto _Continuation = [_PParam](task< void > _ResultTask) mutable {
7274
+ auto _Continuation = [_PParam](_Ty _ResultTask) mutable {
7302
7275
// Dev10 compiler needs this.
7303
7276
auto _PParam1 = _PParam;
7304
7277
auto _Func = [&_ResultTask, _PParam1]() {
@@ -7321,18 +7294,10 @@ task<_Ty> task_from_result(_Ty _Param, const task_options& _TaskOptions = task_o
7321
7294
return create_task (_Tce, _TaskOptions);
7322
7295
}
7323
7296
7324
- // Work around VS 2010 compiler bug
7325
- #if _MSC_VER == 1600
7326
- inline task<bool > task_from_result (bool _Param)
7327
- {
7328
- task_completion_event<bool > _Tce;
7329
- _Tce.set (_Param);
7330
- return create_task (_Tce, task_options ());
7331
- }
7332
- #endif
7333
- inline task<void > task_from_result (const task_options& _TaskOptions = task_options())
7297
+ template <class _Ty = void >
7298
+ inline task<_Ty> task_from_result (const task_options& _TaskOptions = task_options())
7334
7299
{
7335
- task_completion_event<void > _Tce;
7300
+ task_completion_event<_Ty > _Tce;
7336
7301
_Tce.set ();
7337
7302
return create_task (_Tce, _TaskOptions);
7338
7303
}
@@ -7367,3 +7332,4 @@ namespace concurrency = Concurrency;
7367
7332
#endif
7368
7333
7369
7334
#endif // _PPLXTASKS_H
7335
+
0 commit comments