Bewerken

Delen via


<forward_list> operators

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

left
An object of type forward_list.

right
An object of type forward_list.

Remarks

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

operator!=

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

left
An object of type forward_list.

right
An 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).

operator<

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

left
An object of type forward_list.

right
An 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 class template forward_list. The function returns lexicographical_compare(lhs. begin(), lhs. end(), rhs.begin(), rhs.end()).

operator<=

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

left
An object of type forward_list.

right
An 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).

operator>

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

left
An object of type forward_list.

right
An 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.

operator>=

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

left
An object of type forward_list.

right
An 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).