Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[small_map] Use hidden friends for operator==/!= #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Aug 3, 2022

  1. [small_map] Use hidden friends for operator==/!=

    `clang -std=c++2b` complains about the old way:
    
        ./src/base/small_map.h:555:40: warning: all paths through
        this function will call itself [-Winfinite-recursion]
            const const_iterator& other) const {
                                               ^
    
    There are two pieces to the "right" solution: First, use the hidden
    friend idiom to make sure all our operator==s are symmetrical and
    don't treat the first argument differently from the second. Second,
    eliminate the heterogeneous comparison operators; just rely
    on the existing implicit conversion from `iterator` to `const_iterator`
    to do the right thing.
    Quuxplusone committed Aug 3, 2022
    Configuration menu
    Copy the full SHA
    a007772 View commit details
    Browse the repository at this point in the history