diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2021-11-11 17:46:27 -0800 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2021-11-12 20:41:47 -0800 |
commit | 6b9b86db9dd974585a5c71cf2e5231d1e3385f7c (patch) | |
tree | 58dce0de4f6e40bdc7d42b480e9cfcdd6d663a0a /llvm/unittests/Support/ErrorTest.cpp | |
parent | 75c86c9935925f841c1c4e0396b701210358489a (diff) | |
download | llvm-6b9b86db9dd974585a5c71cf2e5231d1e3385f7c.zip llvm-6b9b86db9dd974585a5c71cf2e5231d1e3385f7c.tar.gz llvm-6b9b86db9dd974585a5c71cf2e5231d1e3385f7c.tar.bz2 |
ADT: Fix const-correctness of iterator facade
Fix the const-ness of `iterator_facade_base::operator->` and
`iterator_facade_base::operator[]`. This is a follow-up to
1b651be0465de70cfa22ce4f715d3501a4dcffc1, which fixed const-ness of
various iterator adaptors.
Iterators, like the pointers that they generalize, have two types of
`const`.
- The `const` qualifier on members indicates whether the iterator
itself can be changed. This is analagous to `int *const`.
- The `const` qualifier on return values of `operator*()`,
`operator[]()`, and `operator->()` controls whether the the
pointed-to value can be changed. This is analogous to `const int*`.
If an iterator facade returns a handle to its own state, then T (and
PointerT and ReferenceT) should usually be const-qualified. Otherwise,
if clients are expected to modify the state itself, the field can be
declared mutable or a const_cast can be used.
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
0 files changed, 0 insertions, 0 deletions