Added dyn_array vs. dynarray to FAQ

This commit is contained in:
Herb Sutter 2015-09-29 09:07:44 -07:00
parent bd22a6af2a
commit 8a1d622671

View File

@ -11425,9 +11425,9 @@ No. `owner` owns, is an alias, and can be applied to any indirection type. The m
No. `stack_array` is guaranteed to be allocated on the stack. Although a `std::array` contains its storage directly inside itself, the `array` object can be put anywhere, including the heap. No. `stack_array` is guaranteed to be allocated on the stack. Although a `std::array` contains its storage directly inside itself, the `array` object can be put anywhere, including the heap.
### <a name="Faq-gsl-dyn-array"></a> FAQ.58: Is `dyn_array` the same as `vector`? ### <a name="Faq-gsl-dyn-array"></a> FAQ.58: Is `dyn_array` the same as `vector` or the proposed `dynarray`?
No. `dyn_array` is not resizable, and is a safe way to refer to a heap-allocated fixed-size array. It is intended to replace array-`new[]`. No. `dyn_array` is not resizable, and is a safe way to refer to a heap-allocated fixed-size array. Unlike `vector`, it is intended to replace array-`new[]`. Unlike the `dynarray` that has been proposed in the committee, this does not anticipate compiler/language magic to somehow allocate it on the stack when it is a member of an object that is allocated on the stack; it simply refers to a "dynamic" or heap-based array.
### <a name="Faq-gsl-expects"></a> FAQ.59. Is `Expects` the same as `assert`? ### <a name="Faq-gsl-expects"></a> FAQ.59. Is `Expects` the same as `assert`?