constant size arrays - why never a simulation of push pop?
Maybe there is a good reason for this, but I've often wondered why there is no version of constant size arrays that support push_back() and pop_back(). In the past I've wanted to use a c_array in situations, but couldn't because at some point I wanted to use an algorithm or template function that used push/pop. So I end up using vector/reserve. I can't think of any problem off the top of my head. Seems like just some management of current size(), iterator manipulation etc. Maybe there is some reason I've never seen this or perhaps there is something I'd run into if I tried to roll my own based off of boost::array or c_array? Thanks Frank
"Frank Maddin"
Maybe there is a good reason for this, but I've often wondered why there is no version of constant size arrays that support push_back() and pop_back().
I recall that if one wants the array to be of a type that is not default-constructible, the storage must be something like a raw character array, which introduces some alignment problems. Others can likely add more detail. -- Steven E. Harris
participants (2)
-
Frank Maddin
-
Steven E. Harris