On 5/5/2014 12:34 PM, Matei David wrote:
I'm trying to use boost tti has_member_function to test if a user-specified allocator has the expected methods. However, this fails with standard allocators.
#include <iostream> #include <memory> #include
BOOST_TTI_HAS_MEMBER_FUNCTION(deallocate) typedef std::allocator< int > T; int main() { std::cout << has_member_function_deallocate< void (T::*) (T::pointer, T::size_type) >::value << "\n"; } I tried gcc-4.8.2 and clang-3.4. I'm compiling with: {g++|clang++} -std=c++11 -I${BOOST}/include -Wall -Wextra -pedantic -Wno-ignored-qualifiers -g3 -O0
In both cases, I get a 0. However, using "-E" and grep-ing for "\
", I see this signature: void deallocate(pointer __p, size_type)
Shouldn't I be getting a 1? Am I using it the wrong way?
There is no member function called 'deallocate' in the class std::allocator<T>. There is an inherited 'deallocate' function but TTI cannot currently identify inherited types, data, or functions.