Explorar o código

AK: Add FixedArray::fill_with

This is a memset-like utility method.
kleines Filmröllchen %!s(int64=3) %!d(string=hai) anos
pai
achega
500dc83f32
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      AK/FixedArray.h

+ 6 - 0
AK/FixedArray.h

@@ -160,6 +160,12 @@ public:
         ::swap(m_elements, other.m_elements);
     }
 
+    void fill_with(T const& value)
+    {
+        for (size_t i = 0; i < m_size; ++i)
+            m_elements[i] = value;
+    }
+
     using Iterator = SimpleIterator<FixedArray, T>;
     using ConstIterator = SimpleIterator<FixedArray const, T const>;