This is an archive of the discontinued LLVM Phabricator instance.

[SmallVector] Add range versions of append/assign.
AbandonedPublic

Authored by silvas on Nov 5 2020, 1:58 PM.

Details

Summary

These are convenient in a lot of cases, such as when the thing you want
to append/assign is someReallyLongFunctionName() that you'd rather not
write twice or assign to a variable for the paired begin/end calls.

Diff Detail

Event Timeline

silvas created this revision.Nov 5 2020, 1:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2020, 1:58 PM
silvas requested review of this revision.Nov 5 2020, 1:58 PM

LGTM, but it be nice to have another reviewer checking this!

Maybe these would be more effective as generic range-based functions? (is "append(begin, end)" part of the container concept? Not 100% clear to me on a quick check) - would make it usable with a variety of containers in one go instead of adding it to individual containers (& not being able to add it to standard containers)?

silvas updated this revision to Diff 303280.Nov 5 2020, 3:33 PM
This comment was removed by silvas.

Use 64 byte fixed upper limit.

Did you intend to update https://reviews.llvm.org/D90884?

silvas added a comment.Nov 5 2020, 3:38 PM

Use 64 byte fixed upper limit.

Did you intend to update https://reviews.llvm.org/D90884?

Yeah, sorry. My scripts crossed the streams somehow.

silvas added a comment.Nov 5 2020, 4:02 PM

Maybe these would be more effective as generic range-based functions? (is "append(begin, end)" part of the container concept? Not 100% clear to me on a quick check) - would make it usable with a variety of containers in one go instead of adding it to individual containers (& not being able to add it to standard containers)?

Good point! I added such a function to STLExtras.h here: https://reviews.llvm.org/D90894
(I didn't add one for "assign" since I didn't have an immediate use case. I handled it in assign for this patch for consistency since it seemed there was parallel functionality there for SmallVector in particular)

silvas abandoned this revision.Nov 5 2020, 8:35 PM

Abandoning. Replaced by https://reviews.llvm.org/D90894