Implement ==
operator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(key_base), | intent(in) | :: | lhs | Left hand side. |
||
class(*), | intent(in) | :: | rhs | Rigth hand side. |
elemental logical function is_equal(lhs, rhs)
!---------------------------------------------------------------------------------------------------------------------------------
!< Implement `==` operator.
!---------------------------------------------------------------------------------------------------------------------------------
class(key_base), intent(in) :: lhs !< Left hand side.
class(*), intent(in) :: rhs !< Rigth hand side.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
is_equal = .false.
if (allocated(lhs%id_)) then
select type(rhs)
class is(key_base)
if (allocated(rhs%id_)) is_equal = lhs%id_==rhs%id_
type is(integer(I1P))
is_equal = lhs%id_==rhs
type is(integer(I2P))
is_equal = lhs%id_==rhs
type is(integer(I4P))
is_equal = lhs%id_==rhs
type is(integer(I8P))
is_equal = lhs%id_==rhs
type is(character(len=*))
if (allocated(lhs%char_key_)) is_equal = lhs%char_key_==rhs
endselect
endif
!---------------------------------------------------------------------------------------------------------------------------------
endfunction is_equal