Bug fixes + tabbing
[iotcloud.git] / version2 / src / C / vector.h
index 1d468a7fc835e723f403fe73d91ec9f841e0be3b..e1378c900e0c447b7b70413f3130024eddc6e4f8 100644 (file)
@@ -31,9 +31,9 @@ public:
        }
 
        void remove(type t) {
-               for (uint i=0; i<fldsize; i++) {
+               for (uint i = 0; i < fldsize; i++) {
                        if (array[i] == t) {
-                               for (i++; i<fldsize; i++) {
+                               for (i++; i < fldsize; i++) {
                                        array[i - 1] = array[i];
                                }
                                fldsize--;
@@ -41,14 +41,14 @@ public:
                        }
                }
        }
-       
+
        void removeIndex(uint i) {
-               for (i++; i<fldsize; i++) {
+               for (i++; i < fldsize; i++) {
                        array[i - 1] = array[i];
                }
                fldsize--;
        }
-       
+
        type last() const {
                return array[fldsize - 1];
        }
@@ -71,6 +71,12 @@ public:
                memcpy(&array[fldsize], v->array, v->fldsize * sizeof(type));
        }
 
+       void removeAll(Vector<type> *v) {
+               uint vsize = v->size();
+               for (uint i = 0; i < vsize; i++)
+                       remove(v->get(i));
+       }
+
        void add(type item) {
                if (fldsize >= capacity) {
                        uint newcap = capacity << 1;
@@ -81,7 +87,7 @@ public:
        }
 
        type lastElement() {
-               return get(size()-1);
+               return get(size() - 1);
        }
 
        type firstElement() {