Added setVector in common.hpp
diff --git a/ndn-cpp/common.hpp b/ndn-cpp/common.hpp
index 4b146db..f763d55 100644
--- a/ndn-cpp/common.hpp
+++ b/ndn-cpp/common.hpp
@@ -6,6 +6,7 @@
#ifndef NDN_COMMON_HPP
#define NDN_COMMON_HPP
+#include <vector>
#include "../config.h"
// Depending on where ./configure found shared_ptr, define the ptr_lib namespace.
@@ -21,4 +22,21 @@
#error "Can't find shared_ptr in std or boost"
#endif
+namespace ndn {
+
+/**
+ * Clear the vector and copy valueLength bytes from value.
+ * @param v the vector to copy to
+ * @param value the array of bytes, or 0 to not copy
+ * @param valueLength the length of value
+ */
+static inline void setVector(std::vector<unsigned char> &vec, const unsigned char *value, unsigned int valueLength)
+{
+ vec.clear();
+ if (value)
+ vec.insert(vec.begin(), value, value + valueLength);
+}
+
+}
+
#endif