HookLogger could reveal allocations inside, if you are that interested. Anyway, so far you were complaining about memory usage. And yes, your code is wasting memory, my proposal may waste CPU cycles. There is always a tradeoff.
Originally Posted by jan_ole
Check it once more. The "hole theory" was explained using the worst case, p=4. 4 > 2 as far as I can remember.
The "hole" theory is nice, but fails as soon as your p > 2.
No, sorry, didn't notice that.
I wouldn't mind the example using ConvertFromUnicodeToUtf8L() and then a simple strncpy like mechanism. I'd actually preferred that.
could do that (or using the similar constructor of std::string).
It will not necessarily work, I do not speak STL in fact. And it can be a problem if the string operation runs out of memory.