aboutsummaryrefslogtreecommitdiff
path: root/lout/misc.hh
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-03-01 21:26:25 +0100
committerSebastian Geerken <devnull@localhost>2014-03-01 21:26:25 +0100
commit975ba73389d2de0cd2bb50183bd988eab6ba0e06 (patch)
tree67947a7e22dd049685dc034223c212e2ae14c902 /lout/misc.hh
parent6369c18d186d52f0f3f5082ff6c9fdcf5c9285d1 (diff)
parent8818cda9ca4e4c19c4c5fcee68460d5ba0cd5ba2 (diff)
Merge with main repo.
Diffstat (limited to 'lout/misc.hh')
-rw-r--r--lout/misc.hh34
1 files changed, 17 insertions, 17 deletions
diff --git a/lout/misc.hh b/lout/misc.hh
index 2ed5e1b0..2bb28b12 100644
--- a/lout/misc.hh
+++ b/lout/misc.hh
@@ -92,7 +92,7 @@ private:
}
public:
- inline SimpleVector (int initAlloc)
+ inline SimpleVector (int initAlloc = 1)
{
this->num = 0;
this->numAlloc = initAlloc;
@@ -116,9 +116,9 @@ public:
/**
* \brief Return the number of elements put into this vector.
*/
- inline int size() { return this->num; }
+ inline int size() const { return this->num; }
- inline T* getArray() { return array; }
+ inline T* getArray() const { return array; }
inline T* detachArray() {
T* arr = array;
@@ -163,7 +163,7 @@ public:
*
* \sa misc::SimpleVector::get
*/
- inline T* getRef (int i) {
+ inline T* getRef (int i) const {
assert (i >= 0 && this->num - i > 0);
return array + i;
}
@@ -174,7 +174,7 @@ public:
* The element is copied, so for complex elements, you should rather used
* misc::SimpleVector::getRef.
*/
- inline T get (int i) {
+ inline T get (int i) const {
assert (i >= 0 && this->num - i > 0);
return this->array[i];
}
@@ -182,7 +182,7 @@ public:
/**
* \brief Return the reference of the first element (convenience method).
*/
- inline T* getFirstRef () {
+ inline T* getFirstRef () const {
assert (this->num > 0);
return this->array;
}
@@ -190,7 +190,7 @@ public:
/**
* \brief Return the first element, explicitly.
*/
- inline T getFirst () {
+ inline T getFirst () const {
assert (this->num > 0);
return this->array[0];
}
@@ -198,7 +198,7 @@ public:
/**
* \brief Return the reference of the last element (convenience method).
*/
- inline T* getLastRef () {
+ inline T* getLastRef () const {
assert (this->num > 0);
return this->array + this->num - 1;
}
@@ -206,7 +206,7 @@ public:
/**
* \brief Return the last element, explicitly.
*/
- inline T getLast () {
+ inline T getLast () const {
assert (this->num > 0);
return this->array[this->num - 1];
}
@@ -352,7 +352,7 @@ public:
free (this->arrayExtra2);
}
- inline int size() { return this->numMain + this->numExtra; }
+ inline int size() const { return this->numMain + this->numExtra; }
inline void increase() { setSize(size() + 1); }
@@ -419,7 +419,7 @@ public:
*
* \sa misc::SimpleVector::get
*/
- inline T* getRef (int i)
+ inline T* getRef (int i) const
{
if (this->startExtra == -1)
return this->arrayMain + i;
@@ -439,7 +439,7 @@ public:
* The element is copied, so for complex elements, you should rather used
* misc::SimpleVector::getRef.
*/
- inline T get (int i)
+ inline T get (int i) const
{
return *(this->getRef(i));
}
@@ -447,7 +447,7 @@ public:
/**
* \brief Return the reference of the first element (convenience method).
*/
- inline T* getFirstRef () {
+ inline T* getFirstRef () const {
assert (size () > 0);
return this->getRef(0);
}
@@ -455,14 +455,14 @@ public:
/**
* \brief Return the first element, explicitly.
*/
- inline T getFirst () {
+ inline T getFirst () const {
return *(this->getFirstRef());
}
/**
* \brief Return the reference of the last element (convenience method).
*/
- inline T* getLastRef () {
+ inline T* getLastRef () const {
assert (size () > 0);
return this->getRef(size () - 1);
}
@@ -470,7 +470,7 @@ public:
/**
* \brief Return the last element, explicitly.
*/
- inline T getLast () {
+ inline T getLast () const {
return *(this->getLastRef());
}
@@ -541,7 +541,7 @@ public:
BitSet(int initBits);
~BitSet();
void intoStringBuffer(misc::StringBuffer *sb);
- bool get(int i);
+ bool get(int i) const;
void set(int i, bool val);
void clear();
};