Edit

Share via


concurrency namespace Operators

operator|| Operator

Creates a task that will complete successfully when either of the tasks supplied as arguments completes successfully.

template<typename ReturnType>
task<ReturnType> operator||(
    const task<ReturnType>& lhs,
    const task<ReturnType>& rhs);

template<typename ReturnType>
task<std::vector<ReturnType>> operator||(
    const task<std::vector<ReturnType>>& lhs,
    const task<ReturnType>& rhs);

template<typename ReturnType>
task<std::vector<ReturnType>> operator||(
    const task<ReturnType>& lhs,
    const task<std::vector<ReturnType>>& rhs);

inline task<void> operator||(
    const task<void>& lhs,
    const task<void>& rhs);

Parameters

ReturnType
The type of the returned task.

lhs
The first task to combine into the resulting task.

rhs
The second task to combine into the resulting task.

Return Value

A task that completes successfully when either of the input tasks has completed successfully. If the input tasks are of type T, the output of this function will be a task<std::vector<T>. If the input tasks are of type void the output task will also be a task<void>.

Remarks

If both of the tasks are canceled or throw exceptions, the returned task will complete in the canceled state, and one of the exceptions, if any are encountered, will be thrown when you call get() or wait() on that task.

operator&& Operator

Creates a task that will complete successfully when both of the tasks supplied as arguments complete successfully.

template<typename ReturnType>
task<std::vector<ReturnType>>  operator&&(
    const task<ReturnType>& lhs,
    const task<ReturnType>& rhs);

template<typename ReturnType>
task<std::vector<ReturnType>>  operator&&(
    const task<std::vector<ReturnType>>& lhs,
    const task<ReturnType>& rhs);

template<typename ReturnType>
task<std::vector<ReturnType>>  operator&&(
    const task<ReturnType>& lhs,
    const task<std::vector<ReturnType>>& rhs);

template<typename ReturnType>
task<std::vector<ReturnType>>  operator&&(
    const task<std::vector<ReturnType>>& lhs,
    const task<std::vector<ReturnType>>& rhs);

inline task<void>  operator&&(
    const task<void>& lhs,
    const task<void>& rhs);

Parameters

ReturnType
The type of the returned task.

lhs
The first task to combine into the resulting task.

rhs
The second task to combine into the resulting task.

Return Value

A task that completes successfully when both of the input tasks have completed successfully. If the input tasks are of type T, the output of this function will be a task<std::vector<T>>. If the input tasks are of type void the output task will also be a task<void>.

Remarks

If one of the tasks is canceled or throws an exception, the returned task will complete early, in the canceled state, and the exception, if one occurs, will be thrown if you call get() or wait() on that task.

operator== Operator

Tests if the concurrent_vector object on the left side of the operator is equal to the concurrent_vector object on the right side.

template<typename T, class A1, class A2>
inline bool operator== (
    const concurrent_vector<T, A1>& _A,
    const concurrent_vector<T, A2>& _B);

Parameters

T
The data type of the elements stored in the concurrent vectors.

A1
The allocator type of the first concurrent_vector object.

A2
The allocator type of the second concurrent_vector object.

_A
An object of type concurrent_vector.

_B
An object of type concurrent_vector.

Return Value

true if the concurrent vector on the left side of the operator is equal to the concurrent vector on the right side of the operator; otherwise false.

Remarks

Two concurrent vectors are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B.

operator!= Operator

Tests if the concurrent_vector object on the left side of the operator is not equal to the concurrent_vector object on the right side.

template<typename T, class A1, class A2>
inline bool operator!= (
    const concurrent_vector<T, A1>& _A,
    const concurrent_vector<T, A2>& _B);

Parameters

T
The data type of the elements stored in the concurrent vectors.

A1
The allocator type of the first concurrent_vector object.

A2
The allocator type of the second concurrent_vector object.

_A
An object of type concurrent_vector.

_B
An object of type concurrent_vector.

Return Value

true if the concurrent vectors are not equal; false if the concurrent vectors are equal.

Remarks

Two concurrent vectors are equal if they have the same number of elements and their respective elements have the same values. Otherwise, they are unequal.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B.

operator< Operator

Tests if the concurrent_vector object on the left side of the operator is less than the concurrent_vector object on the right side.

template<typename T, class A1, class A2>
inline bool operator<(
    const concurrent_vector<T, A1>& _A,
    const concurrent_vector<T, A2>& _B);

Parameters

T
The data type of the elements stored in the concurrent vectors.

A1
The allocator type of the first concurrent_vector object.

A2
The allocator type of the second concurrent_vector object.

_A
An object of type concurrent_vector.

_B
An object of type concurrent_vector.

Return Value

true if the concurrent vector on the left side of the operator is less than the concurrent vector on the right side of the operator; otherwise false.

Remarks

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B.

operator<= Operator

Tests if the concurrent_vector object on the left side of the operator is less than or equal to the concurrent_vector object on the right side.

template<typename T, class A1, class A2>
inline bool operator<= (
    const concurrent_vector<T, A1>& _A,
    const concurrent_vector<T, A2>& _B);

Parameters

T
The data type of the elements stored in the concurrent vectors.

A1
The allocator type of the first concurrent_vector object.

A2
The allocator type of the second concurrent_vector object.

_A
An object of type concurrent_vector.

_B
An object of type concurrent_vector.

Return Value

true if the concurrent vector on the left side of the operator is less than or equal to the concurrent vector on the right side of the operator; otherwise false.

Remarks

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B.

operator> Operator

Tests if the concurrent_vector object on the left side of the operator is greater than the concurrent_vector object on the right side.

template<typename T, class A1, class A2>
inline bool operator>(
    const concurrent_vector<T, A1>& _A,
    const concurrent_vector<T, A2>& _B);

Parameters

T
The data type of the elements stored in the concurrent vectors.

A1
The allocator type of the first concurrent_vector object.

A2
The allocator type of the second concurrent_vector object.

_A
An object of type concurrent_vector.

_B
An object of type concurrent_vector.

Return Value

true if the concurrent vector on the left side of the operator is greater than the concurrent vector on the right side of the operator; otherwise false.

Remarks

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B.

operator>= Operator

Tests if the concurrent_vector object on the left side of the operator is greater than or equal to the concurrent_vector object on the right side.

template<typename T, class A1, class A2>
inline bool operator>= (
    const concurrent_vector<T, A1>& _A,
    const concurrent_vector<T, A2>& _B);

Parameters

T
The data type of the elements stored in the concurrent vectors.

A1
The allocator type of the first concurrent_vector object.

A2
The allocator type of the second concurrent_vector object.

_A
An object of type concurrent_vector.

_B
An object of type concurrent_vector.

Return Value

true if the concurrent vector on the left side of the operator is greater than or equal to the concurrent vector on the right side of the operator; otherwise false.

Remarks

The behavior of this operator is identical to the equivalent operator for the vector class in the std namespace.

This method is not concurrency-safe with respect to other methods that could modify either of the concurrent vectors _A or _B.

See also

concurrency Namespace