# HG changeset patch # User John Tsiombikas # Date 1396735970 -10800 # Node ID 18bdbcbaee81e9ab636898d88cf6f48e4b455474 # Parent 9035507275d653f61de0f344c1c15f9e0f8f3be1 forgot to add stl/vector.h diff -r 9035507275d6 -r 18bdbcbaee81 src/stl/vector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/stl/vector.h Sun Apr 06 01:12:50 2014 +0300 @@ -0,0 +1,103 @@ +/* vi:set ft=cpp: */ +#ifndef VECTOR_H_ +#define VECTOR_H_ + +template +class vector { +private: + T *data; + size_t num_items, max_items; + +public: + vector() + { + data = 0; + num_items = max_items = 0; + } + + vector(const vector &v) + { + data = 0; + num_items = max_items = 0; + resize(v.size()); + + for(size_t i=0; i 0) { + T *newdata = new T[nsz]; + if(!newdata) return; + + size_t num = num_items < nsz ? num_items : nsz; + for(size_t i=0; i= max_items) { + resize(max_items > 0 ? max_items * 2 : 8); + } + data[num_items++] = item; + } + + T &operator [](int idx) + { + return data[idx]; + } + + const T &operator [](int idx) const + { + return data[idx]; + } +}; + +#endif // VECTOR_H_ diff -r 9035507275d6 -r 18bdbcbaee81 util/fixcase --- a/util/fixcase Sat Apr 05 20:53:44 2014 +0300 +++ b/util/fixcase Sun Apr 06 01:12:50 2014 +0300 @@ -1,6 +1,7 @@ #!/bin/sh -for i in src/* util/*; do +src=`find \( -iname '*.c' -o -iname '*.cc' -o -iname '*.h' -o -iname '*.inl' \)` +for i in $src util/*; do if echo $i | grep '[A-Z]' >/dev/null; then fixed=`echo $i | tr '[:upper:]' '[:lower:]'` echo "\"$i\" -> \"$fixed\""