Parcourir la source

Add new constructor to value Class with vector

Eric Ramat il y a 3 ans
Parent
commit
60ba269600
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      src/artis-star/common/Value.hpp

+ 5 - 3
src/artis-star/common/Value.hpp

@@ -54,13 +54,15 @@ public:
   Value(const T *value, size_t size)
   { assign(value, sizeof(T) * size, typeid(T *).hash_code()); }
 
+  template<typename T>
+  Value(const std::vector <T> &value, size_t size)
+  { assign(value.data(), sizeof(T) * value.size(), typeid(T *).hash_code()); }
+
   Value(void *content, size_t size)
   { assign(content, size, typeid(void *).hash_code()); }
 
   Value(const char *value, unsigned int size)
-  {
-    assign(value, size * sizeof(char), typeid(char *).hash_code());
-  }
+  { assign(value, size * sizeof(char), typeid(char *).hash_code()); }
 
   Value(const Value &value)
   {