Const correctness on Java Collection Size.
I need to get rid of these, but cleaning them up first lets me address them in-situ for const correctness _before_ I unravel the runtime type maze.
This commit is contained in:
@ -121,7 +121,7 @@ Vector::~Vector()
|
|||||||
DBG_OBJ_DELETE ();
|
DBG_OBJ_DELETE ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Vector::size ()
|
int Vector::size () const
|
||||||
{
|
{
|
||||||
return numElements;
|
return numElements;
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ HashSet::~HashSet()
|
|||||||
delete[] table;
|
delete[] table;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HashSet::size ()
|
int HashSet::size () const
|
||||||
{
|
{
|
||||||
return numElements;
|
return numElements;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ class Collection: public Collection0
|
|||||||
public:
|
public:
|
||||||
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
void intoStringBuffer(misc::StringBuffer *sb) const override;
|
||||||
inline Iterator iterator() { Iterator it(createIterator()); return it; }
|
inline Iterator iterator() { Iterator it(createIterator()); return it; }
|
||||||
virtual int size() = 0;
|
virtual int size() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ public:
|
|||||||
Vector(int initSize, bool ownerOfObjects);
|
Vector(int initSize, bool ownerOfObjects);
|
||||||
~Vector();
|
~Vector();
|
||||||
|
|
||||||
int size();
|
int size() const override;
|
||||||
|
|
||||||
void put(object::Object *newElement, int newPos = -1);
|
void put(object::Object *newElement, int newPos = -1);
|
||||||
void insert(object::Object *newElement, int pos);
|
void insert(object::Object *newElement, int pos);
|
||||||
@ -315,7 +315,7 @@ public:
|
|||||||
HashSet(bool ownerOfObjects, int tableSize = 251);
|
HashSet(bool ownerOfObjects, int tableSize = 251);
|
||||||
~HashSet();
|
~HashSet();
|
||||||
|
|
||||||
int size ();
|
int size () const override;
|
||||||
|
|
||||||
void put (object::Object *object);
|
void put (object::Object *object);
|
||||||
bool contains (object::Object *key) const;
|
bool contains (object::Object *key) const;
|
||||||
|
Reference in New Issue
Block a user