In this particular example, your code does not cause any direct allocations on the heap. However, you can use any method to use the heap for part of its work. This is great if the implementation of the method is correctly cleared after itself.
This logic applies to methods such as operator<<(std::ostream&, T) .
Jaredpar
source share