Item-49 Understand the behavior of the new handler
· β 6 min read
set-new-handler
allows you to specify a function to be called when memory allocation requests cannot be satisfied.
set-new-handler
allows you to specify a function to be called when memory allocation requests cannot be satisfied.
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.
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.
When writing a class template that offers functions related to the template that support implicit type conversions on all parameters, define those functions as friends inside the class template.
In order to implicitly convert all compatible types for a template class, we neet not a constructor function but a constructor template - member functoin templates that generate member functions of a class.