From 5e2e6e9e8a06a3a54e74b889d167a094d74f5d5a Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 5 Oct 2017 20:32:16 -0500 Subject: COMMON: Switch to compile-time checking of invalid SortedArray calls Runtime error detection is error-prone and unnecessary. --- common/array.h | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'common') diff --git a/common/array.h b/common/array.h index bb7e03c4f7..1645db05b1 100644 --- a/common/array.h +++ b/common/array.h @@ -418,31 +418,19 @@ public: Array::insert(where, element); } - T &operator[](size_type idx) { - error("Operation []= not allowed with SortedArray"); - } +private: + T &operator[](size_type idx); - void insert_at(size_type idx, const T &element) { - error("Operation insert_at(idx, element) not allowed with SortedArray"); - } + void insert_at(size_type idx, const T &element); - void insert_at(size_type idx, const Array &array) { - error("Operation insert_at(idx, array) not allowed with SortedArray"); - } + void insert_at(size_type idx, const Array &array); - void insert(iterator pos, const T &element) { - error("Operation insert(pos, elemnet) not allowed with SortedArray"); - } + void insert(iterator pos, const T &element); - void push_back(const T &element) { - error("Operation push_back(element) not allowed with SortedArray"); - } + void push_back(const T &element); - void push_back(const Array &array) { - error("Operation push_back(array) not allowed with SortedArray"); - } + void push_back(const Array &array); -private: // Based on code Copyright (C) 2008-2009 Ksplice, Inc. // Author: Tim Abbott // Licensed under GPLv2+ @@ -465,7 +453,6 @@ private: return &this->_storage[start_]; } -private: int (*_comparator)(const void *, const void *); }; -- cgit v1.2.3