| Issue |
115801
|
| Summary |
[libc++] `vector::insert_range` should not use `std::copy`
|
| Labels |
libc++
|
| Assignees |
|
| Reporter |
hewillk
|
https://github.com/llvm/llvm-project/blob/de2fad32513f7420988df1cf99aff90e0a067469/libcxx/include/__vector/vector.h#L1317
Unlike `assign_range` which requires `assignable_from<T&, ranges​::​range_reference_t<R>>` , this means that `std::copy` is not necessarily well-formed for `insert_range`:
```cpp
#include <vector>
struct Int {
void operator=(int) = delete;
Int(int);
};
int main() {
std::vector<Int> v;
v.insert_range(v.begin(), std::vector{42});
}
```
https://godbolt.org/z/jo3vjjo5b
Additionally, range-version APIs should not dispatch to the `std::moew` algorithm which only works with C++98 iterators.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs