Boost logo

Boost :

Subject: [boost] Detecting if a class overrides free store functions
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2009-01-06 17:48:50


I want to create a STL allocator that uses a class's static new function
if it exists and will fallback on std::allocator::allocate if it
doesn't. I think it should be easy to do this with sfinae but I don't
see an appropriate type trait to detect if a class provides allocation
and deallocation functions.

Should these be provided?

Maybe
boost::has_allocation_function<T>
boost::has_deallocation_function<T>

or just

boost::has_new<T>
boost::has_delete<T>

-- 
Michael Marcin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk