return_temporary_buffer
Prototypetemplate <class T> void return_temporary_buffer(T* p);
Description
Note: DefinitionDefined in the standard header memory, and in the nonstandard backward-compatibility header algo.h. Requirements on typesPreconditionsThe argument ComplexityExampleint 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);
}
Notes[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 See also |