|
Standard Template Library Programmer's GuidePreconditions • n is nonnegative. • [first, first + n) is a valid range. • Each iterator in [first, first + n) points to a region of uninitialized memory that is large enough to store a value of ForwardIterator's value type. Complexity Linear. Exactly n constructor calls. Example class Int { public: Int(int x) : val(x) {} int get() { return val; } private: int val; }; int main() { const int N = 137; Int val(46); Int* A = (Int*) malloc(N * sizeof(Int)); uninitialized_fill_n(A, N, val); } Notes [1] In particular, this sort of low-level memory management is used in the implementation of some container classes. See also Allocators, construct, destroy, uninitialized_copy, uninitialized_fill, raw_storage_iterator temporary_buffer<ForwardIterator, T> Category: allocators Component type: type Description Some algorithms, such as stable_sort and inplace_merge, are adaptive: they attempt to use extra temporary memory to store intermediate results, and their run-time complexity is better if that extra memory is available ...» |
Код для вставки книги в блог HTML
phpBB
текст
|
|