[all-commits] [llvm/llvm-project] da5f33: [clang-tidy] Adjust size-empty doc because C++11 s...
Niels Dekker via All-commits
all-commits at lists.llvm.org
Mon Dec 2 14:45:28 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: da5f330e84d74aeacdbb801c46282b9eebec6793
https://github.com/llvm/llvm-project/commit/da5f330e84d74aeacdbb801c46282b9eebec6793
Author: Niels Dekker <N.Dekker at lumc.nl>
Date: 2024-12-03 (Tue, 03 Dec 2024)
Changed paths:
M clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.h
M clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
Log Message:
-----------
[clang-tidy] Adjust size-empty doc because C++11 size() is constant-time (#117629)
>From C++11, a conforming `size()` method is guaranteed to be a
constant-time function. `empty()` is not _generally_ more efficient than
`size()`. It might even be implemented in terms of `size()`.
----
Notes:
- Microsoft's STL had implemented `empty()` as `return size() == 0`,
until May 2021: https://github.com/microsoft/STL/pull/1836/files
- The time complexity of `size()` (specifically for `std::set`) was
discussed by the library working group in 2007-2009:
https://cplusplus.github.io/LWG/issue632
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list