From c8160e8dc9f23b58db20c35afd62a19a6c5b6039 Mon Sep 17 00:00:00 2001 From: Nicolas Graziano Date: Mon, 1 Nov 2021 11:46:48 +0100 Subject: [PATCH] Correct array initialisation std::array test={ 1 }; should fill element 1 to 4 with 0; In other library the member data element is public to allow compiler to fill it directly. Use same principle. # Conflicts: # src/array --- src/array | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/array b/src/array index ce4ab00b..8c453b90 100644 --- a/src/array +++ b/src/array @@ -18,22 +18,9 @@ public: typedef const_pointer const_iterator; typedef size_t size_type; -private: value_type _data[N ? N : 1]; public: - array() = default; - array(std::initializer_list init) { - if (init.size() != N) { - // error - } - size_t i = 0; - for(const auto& item : init) { - _data[i++] = item; - } - } - array& operator=(const array& other) = default; - reference operator[](size_type i) { return _data[i]; } const_reference operator[](size_type i) const { return _data[i]; } reference front() { return _data[0]; }