gnzlbg / static_vector

A dynamically-resizable vector with fixed capacity and embedded storage
https://gnzlbg.github.io/static_vector
167 stars 21 forks source link

Rework constructors from Casey's feedback #7

Closed gnzlbg closed 7 years ago

gnzlbg commented 8 years ago

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 il) with "Effects: Equivalent to inline_vector(il.begin(), il.end())"