trait
ComparableCollectionElement
This trait is a temporary solution to enable comparison of collection elements as utilized in the index
and count
methods of a list. This approach will be revised with the introduction of conditional trait conformances.
Implemented traits
AnyType
,
CollectionElement
,
Comparable
,
Copyable
,
EqualityComparable
,
Movable
Methods
__copyinit__
__copyinit__(inout self: T, existing: T, /)
Create a new instance of the value by copying an existing one.
Args:
- existing (
T
): The value to copy.
__moveinit__
__moveinit__(inout self: T, owned existing: T, /)
Create a new instance of the value by moving the value of another.
Args:
- existing (
T
): The value to move.
__lt__
__lt__(self: T, rhs: T) -> Bool
Define whether self
is less than rhs
.
Args:
- rhs (
T
): The right hand side of the comparison.
Returns:
True if self
is less than rhs
.
__le__
__le__(self: T, rhs: T) -> Bool
Define whether self
is less than or equal to rhs
.
Args:
- rhs (
T
): The right hand side of the comparison.
Returns:
True if self
is less than or equal to rhs
.
__eq__
__eq__(self: T, other: T) -> Bool
Define whether two instances of the object are equal to each other.
Args:
- other (
T
): Another instance of the same type.
Returns:
True if the instances are equal according to the type's definition of equality, False otherwise.
__ne__
__ne__(self: T, other: T) -> Bool
Define whether two instances of the object are not equal to each other.
Args:
- other (
T
): Another instance of the same type.
Returns:
True if the instances are not equal according to the type's definition of equality, False otherwise.
__gt__
__gt__(self: T, rhs: T) -> Bool
Define whether self
is greater than rhs
.
Args:
- rhs (
T
): The right hand side of the comparison.
Returns:
True if self
is greater than rhs
.
__ge__
__ge__(self: T, rhs: T) -> Bool
Define whether self
is greater than or equal to rhs
.
Args:
- rhs (
T
): The right hand side of the comparison.
Returns:
True if self
is greater than or equal to rhs
.