MSAN and ASAN also replace new/delete which leads to a link error in these tests. Currently they are unsupported but I think it would be useful if these tests could run with sanitizers.
This patch creates a support header that consolidates the new/delete replacement functionality and checking.
When we are using sanitizers new and delete are no longer replaced and the checks always return true.
I'm not sure why it checks that p is not null. I added an assertion and it never fired. Should count_new.hpp also assert deleted pointers are non-null? Obviously passing a nullptr to delete is legal but I'm not sure why we would be doing that.