Skip to content

Conversation

@fhanau
Copy link
Contributor

@fhanau fhanau commented Dec 30, 2025

No description provided.

kj::Vector<kj::String> scriptTags(tags.size());
for (size_t i = 0; i < tags.size(); i++) {
scriptTags.add(kj::str(tags[i]));
for (auto tag: tags) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this avoids a copy or not...

Suggested change
for (auto tag: tags) {
for (auto& tag: tags) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base type here is capnp::Text which inherits from StringPtr, copying a StringPtr does not result in copying the underlying data. If it actually were kj::String, it would not have compiled with auto tag since kj:String does not have a copy constructor (i.e. our approach for avoiding extra copies would have rejected it). The compiler wouldn't accept auto&, updated to use auto&& instead.

@fhanau fhanau force-pushed the felix/123025-expand-clang-tidy branch from 3d66a83 to cacf227 Compare December 30, 2025 19:18
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.

2 participants