[llvm] [ADT] Make Zippy more iterator-like for lifetime safety (PR #112441)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 06:27:56 PDT 2024


https://github.com/kuhar commented:

What's the impact on compilation times? If I'm reading this right, this will increase the size of Zippy to the size of the value type? For example, if I zip two vectors of `std::string`, the `value_type` will be something like `tuple<string&, string&>` ==> 16B? 

I think concat works around it without an extra member? https://github.com/llvm/llvm-project/blob/df0551298868b164197a4e54e9444120dc96ff53/llvm/include/llvm/ADT/STLExtras.h#L1068-L1089

> identifier/encountered a lifetime issue when using concat+zip, zip would return by value, concat would take references to that value and use them in its result after they had expired.

Could you share a repro? Last time I checked, `concat` also forwarded ranges to its storage, so I'm not exactly sure what the issue is.

https://github.com/llvm/llvm-project/pull/112441


More information about the llvm-commits mailing list