From df27188dc6d6cf333145755543f56b2f6657aa5e Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 7 Nov 2023 09:19:24 -0800 Subject: [PATCH] Resolve clang-tidy error: ``` include/pybind11/detail/type_caster_base.h:795:21: error: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty,-warnings-as-errors] if (matching_bases.size() != 0) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ !matching_bases.empty() ``` --- include/pybind11/detail/type_caster_base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h index 50a3b8795..aaf191a60 100644 --- a/include/pybind11/detail/type_caster_base.h +++ b/include/pybind11/detail/type_caster_base.h @@ -792,7 +792,7 @@ public: matching_bases.push_back(base); } } - if (matching_bases.size() != 0) { + if (!matching_bases.empty()) { if (matching_bases.size() > 1) { matching_bases.push_back(const_cast(typeinfo)); all_type_info_check_for_divergence(matching_bases);