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