Extract operator== over vector as utility (#481)
author박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 6 Apr 2018 00:01:46 +0000 (09:01 +0900)
committer김정현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh0822.kim@samsung.com>
Fri, 6 Apr 2018 00:01:46 +0000 (09:01 +0900)
This commit extracts operator== (implemented in nnapi_test) into
'util/vector.h' (for future reuse).

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
include/util/vector.h [new file with mode: 0644]
tools/nnapi_test/src/nnapi_test.cc

diff --git a/include/util/vector.h b/include/util/vector.h
new file mode 100644 (file)
index 0000000..7ae6883
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef __NNFW_UTIL_VECTOR_H__
+#define __NNFW_UTIL_VECTOR_H__
+
+#include <vector>
+
+template <typename T> 
+bool operator==(const std::vector<T> &lhs, const std::vector<T> &rhs)
+{
+  if (lhs.size() != rhs.size())
+  {
+    return false;
+  }
+
+  for (size_t ind = 0; ind < lhs.size(); ++ind)
+  {
+    if (lhs.at(ind) != rhs.at(ind))
+    {
+      return false;
+    }
+  }
+
+  return true;
+}
+
+#endif // __NNFW_UTIL_VECTOR_H__
index 5fc6757..99a2b0c 100644 (file)
@@ -55,24 +55,6 @@ void invoke_interpreter(Interpreter &interpreter)
   check(interpreter.Invoke());
 }
 
-template <typename T> bool operator==(const std::vector<T> &lhs, const std::vector<T> &rhs)
-{
-  if (lhs.size() != rhs.size())
-  {
-    return false;
-  }
-
-  for (size_t ind = 0; ind < lhs.size(); ++ind)
-  {
-    if (lhs.at(ind) != rhs.at(ind))
-    {
-      return false;
-    }
-  }
-
-  return true;
-}
-
 bool operator==(const TfLiteTensor &lhs, const TfLiteTensor &rhs)
 {
   if (lhs.bytes != rhs.bytes)