c++ - Design decision regarding std::array fill -
std::array
in c++11 useful class provides c++ container interface on c stack array.
but why std::array
not have typical fill constructor containers have? instead, has method fill
.
is there reason why std::array
unique among stl containers in regard?
from section 23.3.2.1:
an array aggregate (8.5.1) can initialized syntax array = { initializer-list };
if worked std::vector
wouldn't pod anymore. additionally same section:
the conditions aggregate (8.5.1) shall met.
these conditions are:
an aggregate array or class (clause 9) no user-provided constructors (12.1), no brace-or-equalinitializers non-static data members (9.2), no private or protected non-static data members (clause 11), no base classes (clause 10), , no virtual functions (10.3).
Comments
Post a Comment