[PATCH] D146061: [ADT] Make llvm::is_contained call member `contains` when available
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 14 15:18:30 PDT 2023
nikic added a comment.
In D146061#4194752 <https://reviews.llvm.org/D146061#4194752>, @kuhar wrote:
> Sure, I agree with that. If I have map with a known type like `DenseMap` I'd rather call `.contains(x)` directly too. But this is not possible with C++17 containers `std::`, so I'd argue that until then `is_contained(container, x)` is more readable than something like `container.find(x) != container.end()`.
I don't think we should promote usage of is_contained() for anything but the linear scan case. I don't want to be left guessing whether this is_contained() is a linear scan, or just a slightly different way to write container.find().
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