any c++ tricks?

closed account (Dy7SLyTq)
so i want to make a public domain cookbook full of useful general tricks but i only have two. one is my Str2Int routine which is:
constexpr unsigned int Str2Int(const char *Line, int CurrentPos = 0)
    return !Line[CurrentPos] ? 5381 : (Str2Int(Line, CurrentPos + 1) * 33) ^ Line[CurrentPos];

and making the command line arguments easier for parsing by turning them into std::basic_string<char>.
std::vector<std::string> Arguments(argv, argv + argc);
closed account (yADwAqkS)
Sorry, don't have any, but where will these be put?
I think we all have our own little cookbooks, toyboxes, libraries. I keep mine in a static library that I can link to with any of my projects easily.

I have an extension for std::string which include a "contains()" method, numeric parsing functions, and wide-character support. I have a logging utility which allows me to throw exceptions and log them at the same time. And I have lots and lots of math including PID controllers, n-order integrators, flip-flops, confirmation delays, and a massive Matrix class with about 100 methods.

Whenever I write a very generic function that I don't want to write again, I try to fit it into a class in my library. String utilities are the most monotonous things ever and I hated re-writing those over an over.
closed account (Dy7SLyTq)
i was thinking at least one if not all of these:
a thread (not likely for obvious reason)
an article
a pdf from media fire
a site with them on it. theres one called like that will let me do php so ill probably do that to
closed account (zb0S216C)
Code "tricks" lead to bugs; therefore, I avoid "tricks".

Topic archived. No new replies allowed.