*** empty log message ***
[h316.git] / pc-tools / ldc2 / src / tool.hh
index cfc31bb057875094089a6844f5aec18eeeb42874..1941f7c22654da86c592953f2be5451361b5a0cb 100644 (file)
@@ -9,8 +9,24 @@ using namespace std;
 extern int dump_vector(vector<string> strings);
 extern int dump_vector_fp(vector<string> strings, FILE * fp);
 
-template<typename T>
-extern void merge_vector_unique(vector<T> &target, const vector<T> & source);
 
+/*!
+ *\brief add contents of one vector to another vector uniquely.
+ *\param target Reference to the target vector.
+ *\param source Reference to the vector whose contents are to be added
+ *       to target.
+ */
+template<typename T>
+void merge_vector_unique(vector<T> &target, const vector<T> & source){
+  for (unsigned int isource=0; isource<source.size();isource++){
+    bool already_present=false;
+    for (unsigned int itarget=0;itarget<target.size();itarget++)
+      if (target[itarget]==source[isource]){
+       already_present=true;
+       break;
+      }
+    if (!already_present) target.insert(target.end(),source[isource]);
+  }
+}
 
 #endif