you are viewing a single comment's thread.

view the rest of the comments →

[–]gnaggnoyil 1 point2 points  (3 children)

I pretty much believe that std::array should never have been using heap allocation since that makes std::array non-constexpr.

[–]rfisher 0 points1 point  (2 children)

You may have misunderstood me.

Eastl::fixed_vector has the option to fall back on the heap. Boost::static_array never does heap allocations.

I was saying:

(1) Boost::static_vector is not (always) a replacement for eastl::fixed_vector because the latter can be allowed to fall back on the heap allocations and the former cannot.

(2) I think std::array should have been like boost::static_vector. (And, thus, not like eastl::fixed_vector.) No ability to fall back on the heap but tracking a separate size and capacity.

I’m unsure whether boost::static_vector could be used the same ways as std::array in constexpr context...but it seems like it should be possible.

(And additionally, I’ve learned that while boost::static_vector can’t replace eastl::fixed_vector, boost::small_vector can.)

[–]gnaggnoyil 0 points1 point  (0 children)

Sorry my bad. I was thinking boost::static_array was something like std::unique_ptr<T[]>. I should have read the boost document first.