Category: allocators | Component type: function |
template <class T> void return_temporary_buffer(T* p);
Note: get_temporary_buffer and return_temporary_buffer are only provided for backward compatibility. If you are writing new code, you should instead use the temporary_buffer class.
int main() { pair<int*, ptrdiff_t> P = get_temporary_buffer(10000, (int*) 0); int* buf = P.first; ptrdiff_t N = P.second; uninitialized_fill_n(buf, N, 42); int* result = find_if(buf, buf + N, bind2nd(not_equal_to<int>(), 42)); assert(result == buf + N); return_temporary_buffer(buf); }
[1] As is always true, memory that was allocated using a particular allocation function must be deallocated using the corresponding deallocation function. Memory obtained using get_temporary_buffer must be deallocated using return_temporary_buffer, rather than using free or ::operator delete.
privacy policy | | | contact us |
Copyright © 1993-2001 Silicon Graphics, Inc. All rights reserved. | | | Trademark Information |