put most of the code inside pool_allocator namespace
define new constructor to catch bad casts at runtime

Casting from ptr_d to ptr can cause serious problems if not caught:
segmentation fault when the pointer is dereferenced, now a bad cast will
cause an exception right-away