Item-51 Adhere to convention when writing new and delete
· โ˜• 4 min read

operator new should contain an infinite loop trying to allocate memory, should call the new-handler if it can’t satisfy a memory request, and should handle requests for zero bytes; class-specific versions should handle requests for larger blocks than expected. operator delete should do nothing if passed a pointer that is null; class specific versions should handle blocks that are larger than expected.


Item-48 Be aware of template metaprogramming
· โ˜• 5 min read

Template metaprogramming can shift work from runtime to compile-time (thus enabling earlier error dettection and higher runtime performance), can be used to generate custom code based on combinations of policy choices, and can also be used to avoid generating code inappropriate for particular types.


Item-47 Use traits classes for information about types
· โ˜• 6 min read

Implemented by templates and template specializations, traits classes make information about types available during compilation. Combining traints with overloading, it is possible to perform compile-time if...else tests on types.