These are C++ tricks and tips I have found helpful. I call them
C++ Pointers and I hope you'll find them useful too.
C++ Pointersare licensed under the Creative Commons Attribution 4.0 International License. You should review the licence to determine your
You are free to,
provided that you follow the following licence terms,
C++ Pointers. Commercial use of my
C++ Pointersis allowed.
I have the following
structs and STL Containers
All the literature (both on-line and textbooks) I referenced to learn how to use STL containers only showed how to use them to hold primitives, such as integers and strings, and made no mention of how to handle objects or
structs stored in a container. This
C++ Pointer demonstrates how objects and
structs can be stored in STL Maps and Vectors.
The standard practice / recommendation on how to handle a name collision between a class variable and a function is to append an underscore '_' to the end of one of the variable names.
This advice is troublesome when you are adding a mutator member function to an existing class and the variable is widely used throughout the class. Also the resulting code is untidy with some variable names having underscores and the remainder being without.
C++ pointer shows you how to have member function variables and class variables with same name.