From fb193b02d497e0a3f2e8439e72aa4be99d92c271 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Mon, 29 Dec 2014 13:13:42 -0500 Subject: [PATCH] generalized some Common functions to operate on templated data structures --- openbr/core/common.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openbr/core/common.h b/openbr/core/common.h index 056dbaa..1a9be82 100644 --- a/openbr/core/common.h +++ b/openbr/core/common.h @@ -72,8 +72,8 @@ QList< QPair > Sort(const QList &vals, bool decending = false, int n = /*! * \brief Returns the minimum, maximum, minimum index, and maximum index of a vector of values. */ -template -void MinMax(const QList &vals, T *min, T *max, int *min_index, int *max_index) +template class V, typename T> +void MinMax(const V &vals, T *min, T *max, int *min_index, int *max_index) { const int size = vals.size(); assert(size > 0); @@ -92,23 +92,23 @@ void MinMax(const QList &vals, T *min, T *max, int *min_index, int *max_index } } -template -void MinMax(const QList &vals, T *min, T *max) +template class V, typename T> +void MinMax(const V &vals, T *min, T *max) { int min_index, max_index; MinMax(vals, min, max, &min_index, &max_index); } -template -T Min(const QList &vals) +template class V, typename T> +T Min(const V &vals) { T min, max; MinMax(vals, &min, &max); return min; } -template -T Max(const QList &vals) +template class V, typename T> +T Max(const V &vals) { T min, max; MinMax(vals, &min, &max); -- libgit2 0.21.4