<forward_list> operators

Visual Studio 2015
 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at <forward_list> operators.

operator!=](#operator_neq)|operator>|operator>=|
|operator<|operator<=|operator==|

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

bool operator==(
    const forward_list <Type, Allocator>& left,
    const forward_list <Type, Allocator>& right);

Parameters

ParameterDescription
leftAn object of type forward_list.
rightAn object of type forward_list.

Remarks

This template function overloads operator== to compare two objects of template class forward_list. The function returns distance(left.begin(), end()) == distance(right.begin(),right.end()) && equal(left. begin(),left. end(),right.begin()).

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

bool operator!=(
    const forward_list <Type, Allocator>& left,
    const forward_list <Type, Allocator>& right);

Parameters

ParameterDescription
leftAn object of type forward_list.
rightAn object of type forward_list.

Return Value

true if the lists are not equal; false if the lists are equal.

Remarks

This template function returns !(left == right).

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

bool operator<(
    const forward_list <Type, Allocator>& left,
    const forward_list <Type, Allocator>& right);

Parameters

ParameterDescription
leftAn object of type forward_list.
rightAn object of type forward_list.

Return Value

true if the list on the left side of the operator is less than but not equal to the list on the right side of the operator; otherwise false.

Remarks

This template function overloads operator< to compare two objects of template class forward_list. The function returns lexicographical_compare(lhs. begin(), lhs. end(), rhs.begin(), rhs.end()).

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

bool operator<=(
    const forward_list <Type, Allocator>& left,
    const forward_list <Type, Allocator>& right);

Parameters

ParameterDescription
leftAn object of type forward_list.
rightAn object of type forward_list.

Return Value

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

Remarks

This template function returns !(right < left).

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

bool operator>(
    const forward_list <Type, Allocator>& left,
    const forward_list <Type, Allocator>& right);

Parameters

ParameterDescription
leftAn object of type forward_list.
rightAn object of type forward_list.

Return Value

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

Remarks

This template function returns right < left.

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

bool operator>=(
    const forward_list <Type, Allocator>& left,
    const forward_list <Type, Allocator>& right);

Parameters

ParameterDescription
leftAn object of type forward_list.
rightAn object of type forward_list.

Return Value

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

Remarks

The template function returns !(left < right).

<forward_list>

Show: