<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58292>58292</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
variant::index() check - can you remove it?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DenisYaroshevskiy
</td>
</tr>
</table>
<pre>
Hi!
Right now there is a branch in variant::index():
https://github.com/llvm/llvm-project/blob/183bf9b34b7a0880fea2fcea3e805abdc890290f/libcxx/include/variant#L802
And that's used all over the variant implementation.
However, all that branch does is to convert from one `npos` to a different `npos`.
It is a nice optimisation to not use `index()` internally and instead be more efficient.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVUk1v2zAM_TX2hWggS3FsH3zIFgQdsNNuO-qDjrnKUmDJafPvR7sI2h52GCBIpEg-vkfJRHfvn6mQVSFOhTi-77_oMmYI8RXyiDMCJdBgZh3sCBTgpmfSIRfqyIuCw7dCtoXs1outfsz5mlZPnnldKI-L2dk4seP97XE8Xef4B21m1_ho-KhaZYbOqL1ptGhbMaCWg0WtsBW1Ns62nZCdGFYAMvaN-54pWL84ZOtBS6qfrZCf9RyDYyWaQ02CJaED7T3EG86rwIceoOnqccKQdaYYdp8RnuMrcnohv2-lK9hjIC5iWieUI9gYOCnDMMcJYkAoDiJcY-JjDWtwNAw8UO71EfnS50d-H3YgixCvmSZKG5u1PsS8sl9rP0-dwSlknAMzu4NmrRRSRu3AIEyR3w-HgSxx2y-93vcS--pwqGuhxEGVrleuU50uM2WP_b9eGuyI9gWewOoA97jAjBOPE4hTz-Uy-_6_vwCltGBio25lJ8uxP1S20lK0tdpXcnCtbfgP7EVVqcaZVrWl1wZ96ov6WyFlwFfYINgu6lNJvRRSVpxe1fu9VLtGNo01HXaMr51xxV7gpMnvVh67OF_Kud8omeWSOOgp5fQR1CnRJSBu7RhfL3mMc3_CQOm3nmMa8ZZe6F5uJPpNxF96Ew8Q">