[PATCH] D146061: [ADT] Make llvm::is_contained call member `contains` when available

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 09:57:48 PDT 2023


dblaikie added a comment.

In D146061#4193557 <https://reviews.llvm.org/D146061#4193557>, @nikic wrote:

>> I also considered detecting member contains and triggering a
>> static_assert instead, but decided against it because it's just as easy
>> to do the right thing and call .contains.
>
> I think I would prefer this option, so we keep the ability to distinguish O(1) contains from O(n) is_contained at a glance.

Yeah, that's fair - I'm OK with that too/see the value there. Only issue is in generic code where you might not know the type of a container.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146061/new/

https://reviews.llvm.org/D146061



More information about the llvm-commits mailing list