This is the first of posts, I am going to write primarily for C++ beginners. Where this title “beginner” is a
misnomer in the context of C++. To become a solid C++ beginner takes time and effort.
This is not a good situation. And the reason why, among other reasons, C++ creator (
Bjarne Stroustrup) has written very short but, I think a very important “message to all” called “ Remember the Vasa!“. Please read it. Continue reading “C++ How to simply handle variable number of function arguments”
What is it? Why does it exists?
Four standard char types can be transformed to each other
(Note: this is the second part of
C++ : codecvt deprecated. Panic? )
Standard C++ std lib, is one very complete and useful library. But there are times when you do realize you can build one or two of very simple utilities on top of it.
Simple but sometimes surprisingly powefull.
Continue reading “C++ Convert any character sequence to any standard string”
This is a real architect role description sent to me by a real UK company, as part of the recruitment process.
I have only slightly changed it.
The “Matrix” movie, architect scene. All copyrights do apply.
One size does not fit all
What is “small string optimization”?
Standard C++ string stores its data on the heap. But that is only true if the string grows over an implementation-dependent size. That predefined size for std::string is/was 15 for MSVC and GCC and 23 for Clang. That is: C++ string stays “small”, if you have not asked for bigger than 15/23 sized strings. The string will not attempt to grow its storage on the heap if it can stay small.
Heap memory allocations/de-allocations are taking a lot of time when compared to most standard C run time calls.
Thus if you avoid them your program will run faster and will consume less memory.
Continue reading “C++ Small string optimizations”