Skip to content

refactor: use contains() for associative-container membership checks#16

Draft
smaheshwar-pltr wants to merge 1 commit into
mainfrom
cleanup/use-contains
Draft

refactor: use contains() for associative-container membership checks#16
smaheshwar-pltr wants to merge 1 commit into
mainfrom
cleanup/use-contains

Conversation

@smaheshwar-pltr

@smaheshwar-pltr smaheshwar-pltr commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What

Replace find(x) != end() / find(x) == end() membership tests with the C++20 contains(x) member at five sites: metadata_columns.cc, util/content_file_util.cc, util/struct_like_set.cc, and catalog/rest/auth/auth_properties.cc. In metadata_columns.cc this also avoids invoking the accessor (GetMetadataColumnMap() / GetMetadataFieldIdSet()) twice per call.

Why

contains() is already the prevailing idiom in this codebase and reads more clearly for a pure membership check. The change is behavior-preserving: at each converted site the find() iterator was used only for the boolean test. Sites that dereference the iterator for an actual lookup are intentionally left unchanged.

Replace `find(x) != end()` / `find(x) == end()` membership tests with the
C++20 `contains()` member, matching the codebase's prevailing idiom. In
metadata_columns.cc this also avoids invoking the accessor twice per call.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant