diff options
author | Sebastian Geerken <devnull@localhost> | 2015-01-08 14:51:23 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2015-01-08 14:51:23 +0100 |
commit | 3fa61740d50d8a8fd6c61eb86e1f7a45a3762570 (patch) | |
tree | b6d857642d861fc594292ec69260bfc3cc617be0 /lout | |
parent | e05ebd46d570cd64c116ed4bdde669ea0962e99b (diff) | |
parent | 428094b178eb03d8e500c81837caac402e4b138c (diff) |
Merge with main repo.
Diffstat (limited to 'lout')
-rw-r--r-- | lout/misc.hh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lout/misc.hh b/lout/misc.hh index b362fc2f..a0beb1b6 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -231,6 +231,22 @@ public: assert (this->num > 0); this->array[this->num - 1] = t; } + + /** + * \brief Copies some elements into another vector of the same + * type. + * + * Cannot be used to copy elements within one vector. (For this, + * it would have to be extended to copy backwards in some cases.) + */ + inline void copyTo(SimpleVector<T> *dest, int thisStart = 0, + int thisLast = -1, int destStart = 0) { + assert (dest != this); + if (thisLast == -1) + thisLast = this->size () - 1; + for (int i = thisStart; i <= thisLast; i++) + dest->set (i - thisStart + destStart, get (i)); + } }; /** |