From a3036760840aa8c34c9886a5485057dcf090effb Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Thu, 21 Dec 2017 14:02:12 -0800 Subject: [PATCH] SimpList moved to header-only implementation. --- src/simplist.cc | 73 ------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 src/simplist.cc diff --git a/src/simplist.cc b/src/simplist.cc deleted file mode 100644 index ff92981..0000000 --- a/src/simplist.cc +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include - -constexpr std::size_t DEFAULT_SIZE = 8; - -namespace ods { - -template -SimpList::SimpList() -{ - arr = new T[DEFAULT_SIZE]; - cap = 0; - len = 0; -} - - -template -std::size_t -SimpList::size(void) -{ - assert(len <= cap); - return this->len; -} - - -template -T -SimpList::get(std::size_t i) -{ - if (i >= this->len) { - throw std::invalid_argument("index out of range"); - } - - return this->arr[i]; -} - - -template -T -SimpList::set(std::size_t i, T value) -{ - if (i >= this->len) { - throw std::invalid_argument("index out of range"); - } - // check size, grow as needed - // simple case: check append - // complex case: insertion - return value; -} - - -template -void -SimpList::add(std::size_t i, T value) -{ - return; -} - - -template -T -SimpList::remove(std::size_t i) -{ - if (i >= this->len) { - throw std::invalid_argument("index out of range"); - } - - return this->arr[i]; -} - -} // end namespace ods