<div dir="ltr">Dear Rcpp experst,<div><br></div><div>I hope everyone has had a pleasant Xmas.</div><div><br></div><div>I am just wondering what would be the recommended and most efficient way to check, if a Rcpp Vector contains a given element?</div>
<div><br></div><div>If I am not mistaken the C++ standard approach for very large std::vectors would be to first sort them and then perform a binary search:</div><div><br></div><div><a href="http://stackoverflow.com/questions/571394/how-to-find-an-item-in-a-stdvector">http://stackoverflow.com/questions/571394/how-to-find-an-item-in-a-stdvector</a><br>
</div><div><br></div><div>What would be the Rcpp solution for the same task on a Rcpp vector? </div><div>Should I convert my Rcpp Vector to a std::vector and do the above, as explained on the stackoverflow blog?</div><div>
<br></div><div>Cheers and a happy new year!</div></div>