Quuxplusone / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
https://p1144.godbolt.org/z/jf67zx5hq
Other
0 stars 2 forks source link

[libc++] Simplify overload sets where C::iterator == C::const_iterator #10

Open Quuxplusone opened 1 year ago

Quuxplusone commented 1 year ago

No functional change intended, except to speed up overload resolution. The removed non-const overloads always do exactly the same thing as the const overloads, including having the same return type, because for these set-like types the iterator and const_iterator types are identical by design. (And we'll never change this, because that would break existing user code that assumes they're identical.)

For the record, [associative.req] and [unord.req] both say "It is unspecified whether or not iterator and const_­iterator are the same type."

JoeLoser commented 1 year ago

Nice cleanup!

AMP999 commented 1 year ago

Hi @Quuxplusone ! Is it okay with you if I submit this patch to upstream llvm/llvm-project?

Quuxplusone commented 1 year ago

Hi @Quuxplusone ! Is it okay with you if I submit this patch to upstream llvm/llvm-project?

@AMP999: Yes please, go for it! Thank you! (And I don't care who gets the credit in the PR/commit. You have my permission to do whatever you like with this patch upstream.)