Microsoft's standard library guy says the following (here):
- Could you perhaps explain when to use 'get_temporary_buffer'
It has a very specialized purpose. Note that it doesn't throwexceptions, like new (nothrow), but it also doesn't construct objects,unlike new (nothrow).
It's used internally by the STL in algorithms like stable_partition().This happens when there are magic words like N3126 25.3.13[alg.partitions]/11: stable_partition() has complexity "At most (last
- first) * log(last - first) swaps, but only linear number of swaps if there is enough extra memory." When the magic words "if there isenough extra memory" appear, the STL uses get_temporary_buffer() toattempt to acquire working space. If it can, then it can implement thealgorithm more efficiently. If it can't, because the system is runningdangerously close to out-of-memory (or the ranges involved are huge),the algorithm can fall back to a slower technique.
99.9% of STL users will never need to know about get_temporary_buffer().