Browse Source

Add new method to Value: size

Eric Ramat 1 year ago
parent
commit
800f45b0d8
1 changed files with 9 additions and 0 deletions
  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()) {