I've been browsing around c++ and I found a link to:
I'm wondering is there some sort of master list of these tricks? I'm trying to improve my skills.
I've been browsing around c++ and I found a link to:
I'm wondering is there some sort of master list of these tricks? I'm trying to improve my skills.
Do you mean tricking other developers?
// includeme.h
#define ++ --
#define <= >
#define EPS 1e10
There's no master list that I'm aware of, but the More C++ Idioms Wikibook has a good many listed.
My suggestion, though, is don't try to learn all these idioms and then go use them. Instead, continue working, and when you encounter a problem that makes you ask the question, "How can I do this better?" Then look for an idiom that fits your goals.
You might, however, want to read GotW and the C++ FAQ Lite.
Please see my question here: What are some C++ related idioms, misconceptions, and gotchas that you’ve learnt from experience?
The fact that the scope of temporaries that have been assigned to a const reference of a base class is extended to the scope of the reference is sometimes referred to as "the ScopeGuard trick".
The original article on ScopeGuard is very good reading.
I learned advanced C++ from there: Guru of the Week. It is a compilation of C++ language-related problems rated by difficulty, with solution and explanation.
Add one of these methods into a class definition:
void abort();
or
void terminate();
And add invokations of these methods. Then rename the method in the definition and forget to rename it at any of the invokation points. Enjoy your program crashing "for no reason".