diff options
author | richiesams | 2013-07-11 00:25:09 -0500 |
---|---|---|
committer | richiesams | 2013-08-04 13:32:14 -0500 |
commit | 9c7203c4b922845d63b00236a78e48e4f55bd633 (patch) | |
tree | e0e8380b85ba86791809f8e1dfc937f5a0fd0e6f /engines/zvision | |
parent | 78daaeb583a371edddd67b5399cbc14201fe7ee1 (diff) | |
download | scummvm-rg350-9c7203c4b922845d63b00236a78e48e4f55bd633.tar.gz scummvm-rg350-9c7203c4b922845d63b00236a78e48e4f55bd633.tar.bz2 scummvm-rg350-9c7203c4b922845d63b00236a78e48e4f55bd633.zip |
ZVISION: Create utility method to remove duplicate entries from a Common::Array
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/utility.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index 43d28df6c9..e5713fc7f4 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -56,7 +56,19 @@ void trimCommentsAndWhiteSpace(Common::String *string); */ void dumpEveryResultAction(const Common::String &destFile); +/** + * Removes all duplicate entries from container. + * + * @param container + * @return + */ +template<class T> +void removeDuplicateEntries(Common::Array<T> *container) { + Common::sort(container->front(), container->back()); + for (int i = 0; i < container->size(); i++) { + while (container[i] == container[i +1]) { + container->remove_at(i + 1); } } } |