1 From 6f71069e85fab36d9b95d53ddb6d80b8d1bdb6b0 Mon Sep 17 00:00:00 2001
2 From: Antony Polukhin <antoshkka@gmail.com>
3 Date: Thu, 20 Feb 2014 18:33:20 +0400
4 Subject: [PATCH] Use TypeIndex in Boost.Function to remove duplicate code and
5 improve code performance
8 include/boost/function/function_base.hpp | 22 +---------------------
10 2 files changed, 3 insertions(+), 21 deletions(-)
12 diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp
13 index f3663d7..8fd2c8d 100644
14 --- a/include/boost/function/function_base.hpp
15 +++ b/include/boost/function/function_base.hpp
17 # pragma warning( disable : 4127 ) // "conditional expression is constant"
20 -// Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info.
21 -#ifdef BOOST_NO_STD_TYPEINFO
22 -// Embedded VC++ does not have type_info in namespace std
23 -# define BOOST_FUNCTION_STD_NS
25 -# define BOOST_FUNCTION_STD_NS std
28 -// Borrowed from Boost.Python library: determines the cases where we
29 -// need to use std::type_info::name to compare instead of operator==.
30 -#if defined( BOOST_NO_TYPEID )
31 -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y))
32 -#elif defined(__GNUC__) \
34 - || ( defined(__sgi) && defined(__host_mips))
36 -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \
37 - (std::strcmp((X).name(),(Y).name()) == 0)
39 -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y))
41 +#define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) (boost::typeind::type_index((X))==(Y))
43 #if defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG)
44 # define BOOST_FUNCTION_TARGET_FIX(x) x
45 diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
46 index 68895fa..12a00db 100644
49 @@ -21,6 +21,8 @@ import testing ;
51 [ run libs/function/test/function_test.cpp : : : : lib_function_test ]
53 + [ run libs/function/test/function_test.cpp : : : <rtti>off : lib_function_test_no_rtti ]
55 [ run libs/function/test/function_n_test.cpp : : : : ]
57 [ run libs/function/test/allocator_test.cpp ../../../libs/test/build//boost_test_exec_monitor : : : : ]