Skip to content

Inconsistency of comparison operators for CachedHash #1190

@ddvamp

Description

@ddvamp

/// @brief Compares utils::CachedHash by hash first and then by keys
template <class T>
constexpr bool operator!=(const CachedHash<T>& x, const CachedHash<T>& y) {
return !(x.key == y.key);
}

Здесь хэш не используется для ускорения проверки. Это неконсистентно с комментарием, а также с operator==.

Вероятно, намерением было использовать return !(x == y);.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions