From 1a8f4821a76df0cd7e10bc28f0e9233b79263a8f Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Thu, 4 Dec 2014 11:41:56 -0800 Subject: [PATCH] Replace exception by assertion in autovector Summary: Replace exception by assertion in autovector Test Plan: autovector_test Reviewers: sdong, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D29847 --- util/autovector.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/util/autovector.h b/util/autovector.h index e143c46cb..9362536d3 100644 --- a/util/autovector.h +++ b/util/autovector.h @@ -201,16 +201,12 @@ class autovector { // will check boundry const_reference at(size_type n) const { - if (n >= size()) { - throw std::out_of_range("autovector: index out of range"); - } + assert(n < size()); return (*this)[n]; } reference at(size_type n) { - if (n >= size()) { - throw std::out_of_range("autovector: index out of range"); - } + assert(n < size()); return (*this)[n]; }