boost tti has_member_function
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
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.
On 5/7/2014 12:44 AM, Edward Diener wrote:
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.
I need to correct that last statement. TTI cannot currently identify inherited types, data, and functions if they are protected, but it can if they are public.
On 5/8/2014 1:06 PM, Edward Diener wrote:
On 5/7/2014 12:44 AM, Edward Diener wrote:
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.
I need to correct that last statement. TTI cannot currently identify inherited types, data, and functions if they are protected, but it can if they are public.
Apologies, but I am wrong. TTI cannot currently identify inherited types, data, or functions even if they are public.
participants (2)
-
Edward Diener
-
Matei David