From 39985d2c5158742fc9e00e7dd90559f9f5c8c75f Mon Sep 17 00:00:00 2001 From: sgeerke Date: Sun, 24 Jun 2012 12:06:15 +0200 Subject: First part of hyphenation! And some minor changes in "lout". --- lout/misc.hh | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'lout/misc.hh') 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 #include +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 inline T min (T a, T b) { return a < b ? a : b; } @@ -200,6 +200,38 @@ public: return this->array[i]; } + /** + * \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. * -- cgit v1.2.3