This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Add an version of llvm::join that takes a callable for non-string iterable
AbandonedPublic

Authored by ychen on Aug 10 2020, 5:11 PM.

Details

Diff Detail

Event Timeline

ychen created this revision.Aug 10 2020, 5:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2020, 5:11 PM
ychen requested review of this revision.Aug 10 2020, 5:11 PM
ychen updated this revision to Diff 284544.Aug 10 2020, 6:29 PM
  • update test

Perhaps this should be built by composition with some kind of range transformer (not sure if we have one of those already - maybe we do?), rather than having explicit support in join?

ychen added a comment.Aug 10 2020, 7:23 PM

Perhaps this should be built by composition with some kind of range transformer (not sure if we have one of those already - maybe we do?), rather than having explicit support in join?

I'm not sure we have anything in-tree to use. I was thinking this as something like std::find_if for std::find. Just for convenience and save a temporary container. To use composition without adding a join overload, we need something like python yield?

Perhaps this should be built by composition with some kind of range transformer (not sure if we have one of those already - maybe we do?), rather than having explicit support in join?

I'm not sure we have anything in-tree to use. I was thinking this as something like std::find_if for std::find. Just for convenience and save a temporary container. To use composition without adding a join overload, we need something like python yield?

Ah, that's what I was thinking of - join+map_range?

ychen abandoned this revision.Aug 11 2020, 2:55 PM

Yeah, that should work. Thanks.