The benchmark should use std::vector::at() in that case. at() performs bounds checks.<p><a href="http:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;cpp&#x2F;container&#x2F;vector&#x2F;at" rel="nofollow">http:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;cpp&#x2F;container&#x2F;vector&#x2F;at</a>