C++ Utility Code Series

I’ve been going through some old “utility code” that I wrote in the past, and realized I spent a lot of time trawling through MSDN documentation and random blog posts to assemble these utility functions. Most of these functions never existed in full in any one spot so I figured I should document these solutions for posterity.

In general, these functions are designed to use C++/17 and play well with the standard library. I’ve stuck with single width (char* not wchar_t*) strings where possible and added a lot of comments to explain what’s going on. One area where this code differs a lot from the examples online is a much bigger emphasis on error detection and handling as well as efficiency (avoiding heap allocations when possible). Many of these examples are adapted from work I did professionally (never verbatim copied from any professional project, this is all from memory) and demonstrate industry best practices.

Finally, all code is licensed under MIT-0 which requires no attribution. My only ask is that you don’t misrepresent the origin of this code and if you are feeling generous to leave a reference to where you found the code sample.

I welcome feedback – It’s possible I’ve made mistakes or have implemented some functions sub optimally.