diff options
author | sgeerke <devnull@localhost> | 2012-06-24 12:06:15 +0200 |
---|---|---|
committer | sgeerke <devnull@localhost> | 2012-06-24 12:06:15 +0200 |
commit | 39985d2c5158742fc9e00e7dd90559f9f5c8c75f (patch) | |
tree | 1950c633fd73c1b7ef5056ed18b9dcd527552d3b /lout/misc.hh | |
parent | e02ec1bd1405715f050a71d40a9e3c212dd43123 (diff) |
First part of hyphenation! And some minor changes in "lout".
Diffstat (limited to 'lout/misc.hh')
-rw-r--r-- | lout/misc.hh | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/lout/misc.hh b/lout/misc.hh index 2a8584eb..05b87602 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -7,13 +7,13 @@ #include <string.h> #include <assert.h> +namespace lout { + /** * \brief Miscellaneous stuff, which does not fit anywhere else. * * Actually, the other parts, beginning with ::object, depend on this. */ -namespace lout { - namespace misc { template <class T> inline T min (T a, T b) { return a < b ? a : b; } @@ -201,6 +201,38 @@ public: } /** + * \brief Return the reference of the first element (convenience method). + */ + inline T* getFirstRef () { + assert (this->num > 0); + return this->array; + } + + /** + * \brief Return the first element, explicitly. + */ + inline T getFirst () { + assert (this->num > 0); + return this->array[0]; + } + + /** + * \brief Return the reference of the last element (convenience method). + */ + inline T* getLastRef () { + assert (this->num > 0); + return this->array + this->num - 1; + } + + /** + * \brief Return the last element, explicitly. + */ + inline T getLast () { + assert (this->num > 0); + return this->array[this->num - 1]; + } + + /** * \brief Store an object in the vector. * * Unlike in container::untyped::Vector and container::typed::Vector, |