Boost logo

Boost Users :

Subject: Re: [Boost-users] boost tti has_member_function
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-05-07 00:44:12


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.hpp>
> 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
> "\<deallocate\>", 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net