<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55521>55521</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
libcxx: `path::iterator` has wrong category
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Imre-Palik-Firebolt
</td>
</tr>
</table>
<pre>
According to https://en.cppreference.com/w/cpp/filesystem/path , `path::iterator` should fulfil the concept of _LegacyBidirectionalIterator_. But it is tagger as `typedef input_iterator_tag iterator_category;`
This makes it impossible to call `std::prev()` on `path::iterator`, as `prev()` has the following check:
`_LIBCPP_ASSERT(__n <= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
"Attempt to prev(it, n) with a positive n on a non-bidirectional iterator");`
Changing the `typedef` in `path::iterator` to `typedef bidirectional_iterator_tag iterator_category;`, makes `std::prev()` great again.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9U0tvozAQ_jXmMgoipiTNgUOStlKkHqpt78iYAbx1bGSbpPn3OybpI6vNIgP2mJn5Hri2zalcS2ldo0wHwUIfwuBZvmb8iQaaVA6DwxYdGomptHuKHummMD1bpdGffMAYHkTogfEtsEUW57FKvlYBnQjWURB8b0fdQDtqSoTQI0hLZYcAtoXqGTshTxvVKIcyKGuE3l2SqxRgMwZQNDwE0XXoQPjYKZwGbLAFZYYxVJ_dKvoGvhZSBOysO7F8Qxkse2DZ-q2nSnvxjn6quh-s96rWGEWQQutY24fmTIIkODB-z_gq0rDmJsVI_4zrOqWnYOTbWq3tMWote5TvMX9CQ99Uz7vN9uWlWr--Pv56o9Sqoj75luUPkAFbbmlAVSlfkfbzZVX_FOqLOCVUuyhFlI7lj2eEB6FHJGznZvD3xThfBzKRjCD2F-QqRDKGCMBRkbMCSCIV1AHBRAkEGGtmVyi-FKeCkfgPuc_PbS9MN_1ppMW3eVEhdVvUCOqH0_8m_l_HicjZ6tumdg5FANEJZdKkKfNmla9EElTQWGpVy48PSrkNMRp8dDYae2mdjE6X18epIx3H-nKKtD58vmaDs7-JES2V9yN6mhRFwedJX8pVwZcomzYCqlveSHm_yPPijreixfkq0aJG7UtWbEh1g0eYSkQHiodElTzjPCvmy2xZLPgqXcy55KuML7K8yRd1zu4y3Aul04gjta5LXDlBqsfO06ZWPvjvTUGHpDOIUzuqL8bQW1fu9g5nL0Kr99kTeVNbHZIJRjnR-ANRk2qY">