<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115801>115801</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] `vector::insert_range` should not use `std::copy`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          hewillk
      </td>
    </tr>
</table>

<pre>
    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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE9v-ygQ_TSTC2oEQ_zv4EOT1FKlPaxWu-cIm3FMS0wWsPPrfvoVTpqm1V5WQhgPM4-Zx2NUCOY4EtWQbSHbr9QUB-frgS7G2vdV6_RHPcR4DiCfARvA5mjiMLXrzp0AG2vnz8_T2bs36iJg01rXAjaasFdaYiZkX2yQV2Wpe9H1VaX6vuLEFc-LTV4lANN2v34BNmbs7KQJsDkcZuqi84DNdbEeAOVvQooC-B7483X-a7TmnRjk_FrKwavxSJBzdhlMNzBPf0_GU_jyUK2lQ-_dCeTuT8AccMeWoAAvCCWHcpuKlc_332X34KknT2NHhwhy9wfIlzRyzhJAHExgJ1JjYHFQMZ0Wor7idO78kfxMYKOLbKSOQlDe2A92IWufeudPpFnvfAozYyAf72UkiIdyk2UZ3fl8s6C8kcZA7m6cyZfHoBD91EX2OkYGxfZqY2x2RjN3Jq-WiD1gacYIWDGQe6bJUiSQd_fXtHfzuJuh2H-tl9mMkZ2UGQHLBerrvDsfnznuEqR8YfPDKfP6W_1YzuuWjp9wiemfMMV2gymNH1l9Z-sxwx9ydrp1Nq6dPwI2_wA2b07Ob28uax-DnrU20bhRWftxF8zTTD4YN7Ln318DC4ObrF6uWJtwVrEbWHQsDvRNDSdHl6QGZY_OmzicbkJ1Y9KD8--BXUwc2A5wC7itSmbi9Y7CeqVrqStZqRXVopBCFkXJy9VQt63qSQstVM8lFxlqWeZl2-qi1X0v25WpkeNGCIEcRb4p112XK8EzyTNRouAZbDidlLHr9JYTGysTwkS1EFnJxcqqlmxYugRieq3X7AAxdQ1fLx2gnY4BNtyaEMMXTjTRLv3lISzbJ04-hZBo-SH7RzanQP_1nlaTt_-_Ny1VBcDmVthc478BAAD__yzsgnU">