Parcourir la source

Add new method to Value: size

Eric Ramat il y a 4 ans
Parent
commit
800f45b0d8
1 fichiers modifiés avec 9 ajouts et 0 suppressions
  1. 9 0
      src/artis-star/common/Value.hpp

+ 9 - 0
src/artis-star/common/Value.hpp

@@ -119,6 +119,15 @@ public:
     return *this;
   }
 
+  template<typename Z>
+  size_t size() const
+  {
+
+    assert(is_type<Z>());
+
+    return _size / sizeof(Z);
+  }
+
   std::string to_string() const
   {
     if (empty()) {