[llvm] [ADT] Support appending multiple values (PR #69891)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 22 19:05:10 PDT 2023


kuhar wrote:

V2: I found the original implementation with `initializer_list` to be too close to a foot gun. For instance:
```c++
string x = "x";
string y = "y";
vector<StringRef> refs;
append_range(refs, {x, y});
```
would result in dangling references. Using a variadic template and forwarding all the values makes the behavior much less surprising. I renamed the new overload to `append_values` to differentiate the two.

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


More information about the llvm-commits mailing list