<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/72883>72883</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`<ranges>`: `drop_view::begin const` has O(n) complexity
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</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/f9c47e89c1d6433e3bc28e756e08ebc600a38946/libcxx/include/__ranges/drop_view.h#L104-L108
The wording of `drop_view::begin const` in [[range.drop.view]](https://eel.is/c++draft/range.drop.view) is:
> _Returns_: `ranges::next(ranges::begin(base_), count_, ranges::end(base_))`.
Note that "_Returns_" is used here, which means that the implementation only needs to return the value of `ranges::next` and does not need to obtain the value through `ranges::advance`, which will have 𝒪(n) complexity in the case of random-access-sized but non-common range.
Currently, only MSVC-STL handles this situation correctly.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlEFv4zYQhX_N6DKwQFGyLB10sJPolLZAd9GrQZFjky1FBiTlxP31BRVn410UWxQwbAuYN_O9Rw1FjObsiAbYHmD7WIglaR8GTa_G2r-KyavroFN6iVDvgY_Ax7NJeplK6Wfgo7WXj5_NS_B_kkzAx8n6Cfh46mWzo66XlWqbuqZ6kryj3bYl1tEkW8ZE3fVNmxuYSb69AR-Nk3ZRBHw8HoNwZ4rARxX8y_Fi6LXUwOvnijWb54p1wB6B7e-_v2rCVx-UcWf0J4SWfZNm_no_0dk4lN7FBC1D43D1fVhHlbm4XIu3j_nDu--tE9nSZCAJ_AD8oII4Zb8_qnmPZlXdA9ZPiHj8ndISXDxCvc94N4tPHDoG3eEd8tujo7cEvPt50WoJeDeJSEfgPfAHlH5x6Zj__VxLTn2n7KFl5T31rz4RJi0SAuef8JyjibhEUqgpUB70qo3UOJNw8V2QNKGZXyzN5JJIxjv0zl7REamIyWNYu611F2EXup3YjXgFXQNoGQqnUHmK6HxaG2S9n5Iw9_qkg1_O-scmQl2EkwQt--TMbzdqcSGEkUH_CD2H_R545_LhSZ-530y64m2AFHHlC8IpP2-ElBTjJpq_SeG0JHTebaSfZ-_eE7-F-LCEQC7Za568uv_lyx8Pmy9fn1ELpyzlrEzEaNLyHpH0IZBM9loWaqhVX_eioKHaMdb0dcv6Qg-q2Qold2wiUXWtYC1Vp51oGmq7ifU7VpiBM15XFWfVljPWl5zESUyqky2RalULDaNZGFvmvS19OBcmxoWGHe-6urBiIhs_LoQwrMs9LecIDbMmpvgpSyZZGnKy9cNH5E_r4_6_l0-LiL_9S-TFEuz_v3NWB3k3VxP_BAAA__--EYKS">