Make BalsaHeaders::iterator_base and const_header_lines_iterator copy constructor implicit.

The problem I intend to solve is that Envoy fails to compile the assignment in
balsa_headers_test.cc with the message "error: definition of implicit copy
assignment operator for 'iterator_base' is deprecated because it has a
user-provided copy constructor
[-Werror,-Wdeprecated-copy-with-user-provided-copy]".  (Unfortunately this does
not reproduce internally by adding -Wdeprecated-copy-with-user-provided-copy to
the BUILD file.)

These two classes (one derived from the other) both have explicit copy
constructors, which apparently implicitly deletes their copy assignment operators.
However, if a class has a copy constructor, it should have a copy assignment
operator as well.  The simplest solution to this is to remove the explicit copy
constructor, enabling both the copy constructors and copy assignment operators
to be implicitly defined.

The implementation change here is that `value_` will also be copied.  This is
cheap.  Also, `value_` is regenerated by Lookup() every time it is accessed, and
the API convention is that previously stored return value of operator*() must
not be accessed anyway after the iterator is mutated, for example, by the copy
assignment operator, so changing `value_` in the (now implicit) copy constructor
and copy assignment operator is safe.

Note that `value_` cannot be removed without removing operator->() and rewriting
all of its call sites (for example, `it->first` to `(*it).first`, which is
ugly).

PiperOrigin-RevId: 446022160
1 file changed
tree: a4fa04a6c65f39ba9c2c7dfd7b5442b683ee4f35
  1. quiche/
  2. CONTRIBUTING.md
  3. LICENSE
  4. README.md
README.md

QUICHE

QUICHE stands for QUIC, Http, Etc. It is Google‘s production-ready implementation of QUIC, HTTP/2, HTTP/3, and related protocols and tools. It powers Google’s servers, Chromium, Envoy, and other projects. It is actively developed and maintained.

There are two public QUICHE repositories. Either one may be used by embedders, as they are automatically kept in sync:

To embed QUICHE in your project, platform APIs need to be implemented and build files need to be created. Note that it is on the QUICHE team's roadmap to include default implementation for all platform APIs and to open-source build files. In the meanwhile, take a look at open source embedders like Chromium and Envoy to get started:

To contribute to QUICHE, follow instructions at CONTRIBUTING.md.

QUICHE is only supported on little-endian platforms.