You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Array class in src/ystdlib/containers/Array.hpp has a limitation: it does not support initialization with an initializer list when the contained type lacks a default constructor. This restriction contrasts with std::array, which allows such initialization.
Consider the following class A, which has no default constructor:
This limitation stems from the underlying data structure used in Array, which is std::unique_ptr<T[]>. Since the array memory must be allocated before values can be assigned, the type T must be default-constructible.
To address this, modifications to Array's internal storage mechanism may be required to allow direct initialization of non-default-constructible types from an initializer list.
Requirements
Update Array implementation to support list initialization with non-default-initializable types.
Add appropriate unit tests to verify the behavior.
Update documentation (remove TODOs to reflect the enhanced capabilities).