gnzlbg / static_vector

A dynamically-resizable vector with fixed capacity and embedded storage

Home Page:https://gnzlbg.github.io/static_vector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rework constructors from Casey's feedback

gnzlbg opened this issue · comments

I don't get the description of inline_vector(). What does "it is guaranteed that no elements will be constructed unless value_type models TrivialType, in which case this guarantee is implementation defined." mean? How could an empty inline_vector have constructed elements? Is the intent that inline_vector<T, C> where T is a trivial type always contains C live objects of type T of which only size() participate in the value of the object?

explicit inline_vector(size_type n) should specify "default-initialized" or "value-initialized" elements instead of "default constructed." "throws bad_alloc if \p n > capacity()" seems to contradict the earlier statement that exceeding capacity is a precondition violation.

For inline_vector(InputIterator first, InputIterator last), the requirement you want is "value_type shall be EmplaceConstructible into *this from *first"; the current formulation misses the case that the iterator's reference type is not a reference type. You need also require that InputIterator meets the requirements for an input iterator.

You could replace the entire description of inline_vector(initializer_list<value_type> il) with "Effects: Equivalent to inline_vector(il.begin(), il.end())"