• Christoph Schwering's avatar
    [Autofill] Added type-safe bitset. · 6bf7e04f
    Christoph Schwering authored
    This CL adds a type-safe set container for dense integers, following
    std::set's API.
    
    Currently, there are multiple use-cases in Autofill of the following
    two patterns to express sets of small, dense integers:
    
    Pattern 1:
      enum class E { A = 1, B = 2, C = 3, ... };
      std::set<E> set;
      set.insert(B);
    
    Pattern 2:
      enum E { A = 1 << 0, B = 1 << 2, C = 1 << 3, ... };
      uint32_t bitmask = 0;
      bitmask |= B;
    
    This CL's container combines the type-safety of the former pattern
    with the efficiency of the latter.
    
    Bug: 1007974
    Change-Id: Ida9b9cec244119a27eca2c171b4fb2f52443d099
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350423
    Commit-Queue: Christoph Schwering <schwering@google.com>
    Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#820983}
    6bf7e04f
BUILD.gn 3.13 KB