forked from boostorg/type_index
Final cleanup of directory. Patches were updated. Minor bugfixes.
This commit is contained in:
@ -84,6 +84,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
inline const ctti_type_index::type_info_t& ctti_type_index::type_info() const BOOST_NOEXCEPT {
|
||||
return *data_;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline ctti_type_index ctti_type_index::type_id() BOOST_NOEXCEPT {
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::remove_reference<T>::type no_ref_t;
|
||||
|
@ -3,3 +3,7 @@ patches for Boost libraries to work without RTTI
|
||||
|
||||
Here are the patches that are TESTED and work well with RTTI disabled and enabled.
|
||||
Patches add tests for some of the libraries to make sure that library compile and work without RTTI.
|
||||
|
||||
Patches remove duplicate code, improve output, allow compilation with RTTI off...
|
||||
|
||||
Libraries Boost.Graph, Boost.XPressive, Boost.PropertyMap and others may also benefit from TypeIndex library.
|
||||
|
@ -1,12 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
test-suite any :
|
||||
[ run ../any_test.cpp ]
|
||||
+ [ run ../any_test.cpp : : : <rtti>off : testing_any_no_rtti ]
|
||||
[ run any_test_rv.cpp ]
|
||||
[ compile-fail any_cast_cv_failed.cpp ]
|
||||
[ compile-fail any_test_temporary_to_ref_failed.cpp ]
|
@ -1,91 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -15,7 +15,7 @@
|
||||
// when: July 2001, April 2013 - May 2013
|
||||
|
||||
#include <algorithm>
|
||||
-#include <typeinfo>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
|
||||
#include "boost/config.hpp"
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
@@ -29,17 +29,6 @@
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
-// See boost/python/type_id.hpp
|
||||
-// TODO: add BOOST_TYPEID_COMPARE_BY_NAME to config.hpp
|
||||
-# if defined(__GNUC__) \
|
||||
- || defined(_AIX) \
|
||||
- || ( defined(__sgi) && defined(__host_mips)) \
|
||||
- || (defined(__hpux) && defined(__HP_aCC)) \
|
||||
- || (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC))
|
||||
-# define BOOST_AUX_ANY_TYPE_ID_NAME
|
||||
-#include <cstring>
|
||||
-# endif
|
||||
-
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4172) // Mistakenly warns: returning address of local variable or temporary
|
||||
@@ -149,9 +138,9 @@
|
||||
any().swap(*this);
|
||||
}
|
||||
|
||||
- const std::type_info & type() const BOOST_NOEXCEPT
|
||||
+ const boost::type_info & type() const BOOST_NOEXCEPT
|
||||
{
|
||||
- return content ? content->type() : typeid(void);
|
||||
+ return content ? content->type() : boost::type_id<void>();
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
@@ -170,7 +159,7 @@
|
||||
|
||||
public: // queries
|
||||
|
||||
- virtual const std::type_info & type() const BOOST_NOEXCEPT = 0;
|
||||
+ virtual const boost::type_info & type() const BOOST_NOEXCEPT = 0;
|
||||
|
||||
virtual placeholder * clone() const = 0;
|
||||
|
||||
@@ -194,9 +183,9 @@
|
||||
#endif
|
||||
public: // queries
|
||||
|
||||
- virtual const std::type_info & type() const BOOST_NOEXCEPT
|
||||
+ virtual const boost::type_info & type() const BOOST_NOEXCEPT
|
||||
{
|
||||
- return typeid(ValueType);
|
||||
+ return boost::type_id<ValueType>();
|
||||
}
|
||||
|
||||
virtual placeholder * clone() const
|
||||
@@ -237,7 +226,12 @@
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
- class BOOST_SYMBOL_VISIBLE bad_any_cast : public std::bad_cast
|
||||
+ class BOOST_SYMBOL_VISIBLE bad_any_cast :
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
+ public std::bad_cast
|
||||
+#else
|
||||
+ public std::exception
|
||||
+#endif
|
||||
{
|
||||
public:
|
||||
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
@@ -251,11 +245,7 @@
|
||||
ValueType * any_cast(any * operand) BOOST_NOEXCEPT
|
||||
{
|
||||
return operand &&
|
||||
-#ifdef BOOST_AUX_ANY_TYPE_ID_NAME
|
||||
- std::strcmp(operand->type().name(), typeid(ValueType).name()) == 0
|
||||
-#else
|
||||
- operand->type() == typeid(ValueType)
|
||||
-#endif
|
||||
+ operand->type() == boost::type_id<ValueType>()
|
||||
? &static_cast<any::holder<ValueType> *>(operand->content)->held
|
||||
: 0;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -91,7 +91,10 @@
|
||||
|
||||
check_true(value.empty(), "empty");
|
||||
check_null(any_cast<int>(&value), "any_cast<int>");
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
check_equal(value.type(), typeid(void), "type");
|
||||
+#endif
|
||||
+ check_equal(value.type(), boost::type_id<void>(), "type boost");
|
||||
}
|
||||
|
||||
void test_converting_ctor()
|
||||
@@ -100,7 +103,10 @@
|
||||
any value = text;
|
||||
|
||||
check_false(value.empty(), "empty");
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
check_equal(value.type(), typeid(std::string), "type");
|
||||
+#endif
|
||||
+ check_equal(value.type(), boost::type_id<std::string>(), "type boost");
|
||||
check_null(any_cast<int>(&value), "any_cast<int>");
|
||||
check_non_null(any_cast<std::string>(&value), "any_cast<std::string>");
|
||||
check_equal(
|
||||
@@ -158,7 +164,10 @@
|
||||
any * assign_result = &(value = text);
|
||||
|
||||
check_false(value.empty(), "type");
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
check_equal(value.type(), typeid(std::string), "type");
|
||||
+#endif
|
||||
+ check_equal(value.type(), boost::type_id<std::string>(), "type boost");
|
||||
check_null(any_cast<int>(&value), "any_cast<int>");
|
||||
check_non_null(any_cast<std::string>(&value), "any_cast<std::string>");
|
||||
check_equal(
|
||||
@@ -191,7 +200,10 @@
|
||||
|
||||
check_true(original.empty(), "empty on original");
|
||||
check_false(swapped.empty(), "empty on swapped");
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
check_equal(swapped.type(), typeid(std::string), "type");
|
||||
+#endif
|
||||
+ check_equal(swapped.type(), boost::type_id<std::string>(), "type boost");
|
||||
check_equal(
|
||||
text, any_cast<std::string>(swapped),
|
||||
"comparing swapped copy against original text");
|
||||
@@ -264,8 +276,12 @@
|
||||
check_false(value1.empty(), "type");
|
||||
check_false(value2.empty(), "type");
|
||||
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
check_equal(value1.type(), typeid(const char*), "type");
|
||||
check_equal(value2.type(), typeid(const char*), "type");
|
||||
+#endif
|
||||
+ check_equal(value1.type(), boost::type_id<const char*>(), "type boost");
|
||||
+ check_equal(value2.type(), boost::type_id<const char*>(), "type boost");
|
||||
|
||||
check_non_null(any_cast<const char*>(&value1), "any_cast<const char*>");
|
||||
check_non_null(any_cast<const char*>(&value2), "any_cast<const char*>");
|
131
patched/boost_any.patch
Normal file
131
patched/boost_any.patch
Normal file
@ -0,0 +1,131 @@
|
||||
From b59340efc30219492b095d2cfcdb8183b3e35b69 Mon Sep 17 00:00:00 2001
|
||||
From: Antony Polukhin <antoshkka@gmail.com>
|
||||
Date: Thu, 20 Feb 2014 17:06:44 +0400
|
||||
Subject: [PATCH 1/2] Boost.Any not can work without RTTI support.
|
||||
|
||||
---
|
||||
test/Jamfile.v2 | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
|
||||
index cd167dc..76f9e5a 100644
|
||||
--- a/test/Jamfile.v2
|
||||
+++ b/test/Jamfile.v2
|
||||
@@ -9,6 +9,7 @@
|
||||
test-suite any :
|
||||
[ run any_test.cpp ]
|
||||
[ run any_test_rv.cpp ]
|
||||
+ [ run any_test_rv.cpp : : : <rtti>off : any_test_rv_no_rtti ]
|
||||
[ compile-fail any_cast_cv_failed.cpp ]
|
||||
[ compile-fail any_test_temporary_to_ref_failed.cpp ]
|
||||
[ compile-fail any_test_cv_to_rv_failed.cpp ]
|
||||
--
|
||||
1.8.5.3
|
||||
|
||||
|
||||
From 62b9b01713fc50355f82e892bc0fd5618ce5c648 Mon Sep 17 00:00:00 2001
|
||||
From: Antony Polukhin <antoshkka@gmail.com>
|
||||
Date: Thu, 20 Feb 2014 17:30:42 +0400
|
||||
Subject: [PATCH 2/2] Boost.Any not can work without RTTI support.
|
||||
|
||||
---
|
||||
include/boost/any.hpp | 37 +++++++++++++------------------------
|
||||
1 file changed, 13 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/include/boost/any.hpp b/include/boost/any.hpp
|
||||
index a63fea4..bda00a2 100644
|
||||
--- a/include/boost/any.hpp
|
||||
+++ b/include/boost/any.hpp
|
||||
@@ -15,9 +15,9 @@
|
||||
// when: July 2001, April 2013 - May 2013
|
||||
|
||||
#include <algorithm>
|
||||
-#include <typeinfo>
|
||||
|
||||
#include "boost/config.hpp"
|
||||
+#include <boost/type_index.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/decay.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
@@ -29,17 +29,6 @@
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
-// See boost/python/type_id.hpp
|
||||
-// TODO: add BOOST_TYPEID_COMPARE_BY_NAME to config.hpp
|
||||
-# if defined(__GNUC__) \
|
||||
- || defined(_AIX) \
|
||||
- || ( defined(__sgi) && defined(__host_mips)) \
|
||||
- || (defined(__hpux) && defined(__HP_aCC)) \
|
||||
- || (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC))
|
||||
-# define BOOST_AUX_ANY_TYPE_ID_NAME
|
||||
-#include <cstring>
|
||||
-# endif
|
||||
-
|
||||
namespace boost
|
||||
{
|
||||
class any
|
||||
@@ -144,9 +133,9 @@ namespace boost
|
||||
any().swap(*this);
|
||||
}
|
||||
|
||||
- const std::type_info & type() const BOOST_NOEXCEPT
|
||||
+ const boost::typeind::type_info& type() const BOOST_NOEXCEPT
|
||||
{
|
||||
- return content ? content->type() : typeid(void);
|
||||
+ return content ? content->type() : boost::typeind::type_id<void>().type_info();
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
@@ -165,7 +154,7 @@ namespace boost
|
||||
|
||||
public: // queries
|
||||
|
||||
- virtual const std::type_info & type() const BOOST_NOEXCEPT = 0;
|
||||
+ virtual const boost::typeind::type_info& type() const BOOST_NOEXCEPT = 0;
|
||||
|
||||
virtual placeholder * clone() const = 0;
|
||||
|
||||
@@ -189,9 +178,9 @@ namespace boost
|
||||
#endif
|
||||
public: // queries
|
||||
|
||||
- virtual const std::type_info & type() const BOOST_NOEXCEPT
|
||||
+ virtual const boost::typeind::type_info& type() const BOOST_NOEXCEPT
|
||||
{
|
||||
- return typeid(ValueType);
|
||||
+ return boost::typeind::type_id<ValueType>().type_info();
|
||||
}
|
||||
|
||||
virtual placeholder * clone() const
|
||||
@@ -232,7 +221,12 @@ namespace boost
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
- class BOOST_SYMBOL_VISIBLE bad_any_cast : public std::bad_cast
|
||||
+ class BOOST_SYMBOL_VISIBLE bad_any_cast :
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
+ public std::bad_cast
|
||||
+#else
|
||||
+ public std::exception
|
||||
+#endif
|
||||
{
|
||||
public:
|
||||
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
@@ -245,12 +239,7 @@ namespace boost
|
||||
template<typename ValueType>
|
||||
ValueType * any_cast(any * operand) BOOST_NOEXCEPT
|
||||
{
|
||||
- return operand &&
|
||||
-#ifdef BOOST_AUX_ANY_TYPE_ID_NAME
|
||||
- std::strcmp(operand->type().name(), typeid(ValueType).name()) == 0
|
||||
-#else
|
||||
- operand->type() == typeid(ValueType)
|
||||
-#endif
|
||||
+ return operand && operand->type() == boost::typeind::type_id<ValueType>()
|
||||
? &static_cast<any::holder<ValueType> *>(operand->content)->held
|
||||
: 0;
|
||||
}
|
||||
--
|
||||
1.8.5.3
|
||||
|
@ -1,29 +1,45 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86532)
|
||||
+++ . (working copy)
|
||||
@@ -15,121 +15,15 @@
|
||||
From b77c0af6af8bc4797defc3627878acc3cf7a6f39 Mon Sep 17 00:00:00 2001
|
||||
From: Antony Polukhin <antoshkka@gmail.com>
|
||||
Date: Thu, 20 Feb 2014 17:57:24 +0400
|
||||
Subject: [PATCH] detail/sp_typeinfo.hpp now uses TypeIndex
|
||||
|
||||
---
|
||||
include/boost/detail/sp_typeinfo.hpp | 123 +++--------------------------------
|
||||
1 file changed, 8 insertions(+), 115 deletions(-)
|
||||
|
||||
diff --git a/include/boost/detail/sp_typeinfo.hpp b/include/boost/detail/sp_typeinfo.hpp
|
||||
index 43fae78..fbdf86d 100644
|
||||
--- a/include/boost/detail/sp_typeinfo.hpp
|
||||
+++ b/include/boost/detail/sp_typeinfo.hpp
|
||||
@@ -10,126 +10,19 @@
|
||||
// detail/sp_typeinfo.hpp
|
||||
//
|
||||
// Copyright 2007 Peter Dimov
|
||||
+// Copyright 2014 Antony Polukhin
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
-#include <boost/config.hpp>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
|
||||
-#if defined( BOOST_NO_TYPEID )
|
||||
+#include <boost/type_index.hpp>
|
||||
+namespace boost { namespace detail {
|
||||
|
||||
-#include <boost/current_function.hpp>
|
||||
-#include <functional>
|
||||
+typedef boost::type_info sp_typeinfo;
|
||||
|
||||
-namespace boost
|
||||
-{
|
||||
+
|
||||
+typedef boost::typeind::type_info sp_typeinfo;
|
||||
+
|
||||
+}} // namespace boost::detail
|
||||
|
||||
-#if defined( BOOST_NO_TYPEID )
|
||||
-
|
||||
-#include <boost/current_function.hpp>
|
||||
-#include <functional>
|
||||
-
|
||||
-namespace boost
|
||||
-{
|
||||
-
|
||||
-namespace detail
|
||||
-{
|
||||
+#define BOOST_SP_TYPEID(T) (boost::type_id<T>())
|
||||
|
||||
-
|
||||
-class sp_typeinfo
|
||||
-{
|
||||
-private:
|
||||
@ -127,6 +143,9 @@ Index: .
|
||||
-#define BOOST_SP_TYPEID(T) typeid(T)
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
+#define BOOST_SP_TYPEID(T) (boost::typeind::type_id<T>().type_info())
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
|
||||
+
|
||||
--
|
||||
1.8.5.3
|
||||
|
156
patched/boost_exception.patch
Normal file
156
patched/boost_exception.patch
Normal file
@ -0,0 +1,156 @@
|
||||
From 8f57d59bfbc978673a2493a90b4f3e7e54ddbf18 Mon Sep 17 00:00:00 2001
|
||||
From: Antony Polukhin <antoshkka@gmail.com>
|
||||
Date: Thu, 20 Feb 2014 18:30:11 +0400
|
||||
Subject: [PATCH] Boost.Exception now uses TypeIndex to reduce duplicate code
|
||||
and simplify name demanglings
|
||||
|
||||
---
|
||||
include/boost/exception/detail/type_info.hpp | 43 +++-------------------
|
||||
include/boost/exception/diagnostic_information.hpp | 2 +-
|
||||
include/boost/exception/exception.hpp | 3 +-
|
||||
include/boost/exception/info.hpp | 2 +-
|
||||
test/Jamfile.v2 | 2 +
|
||||
5 files changed, 12 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/include/boost/exception/detail/type_info.hpp b/include/boost/exception/detail/type_info.hpp
|
||||
index 6e5942d..a247b71 100644
|
||||
--- a/include/boost/exception/detail/type_info.hpp
|
||||
+++ b/include/boost/exception/detail/type_info.hpp
|
||||
@@ -12,13 +12,7 @@
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
-#include <boost/detail/sp_typeinfo.hpp>
|
||||
-#include <boost/current_function.hpp>
|
||||
-#include <boost/config.hpp>
|
||||
-//#ifndef BOOST_NO_TYPEID
|
||||
-//#include <boost/units/detail/utility.hpp>
|
||||
-//#endif
|
||||
-#include <string>
|
||||
+#include <boost/type_index.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
@@ -28,11 +22,7 @@ boost
|
||||
std::string
|
||||
tag_type_name()
|
||||
{
|
||||
-#ifdef BOOST_NO_TYPEID
|
||||
- return BOOST_CURRENT_FUNCTION;
|
||||
-#else
|
||||
- return /*units::detail::demangle*/(typeid(T*).name());
|
||||
-#endif
|
||||
+ return boost::typeind::type_id<T*>().pretty_name();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -40,41 +30,20 @@ boost
|
||||
std::string
|
||||
type_name()
|
||||
{
|
||||
-#ifdef BOOST_NO_TYPEID
|
||||
- return BOOST_CURRENT_FUNCTION;
|
||||
-#else
|
||||
- return /*units::detail::demangle*/(typeid(T).name());
|
||||
-#endif
|
||||
+ return boost::typeind::type_id<T>().pretty_name();
|
||||
}
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
- struct
|
||||
- type_info_
|
||||
- {
|
||||
- detail::sp_typeinfo const * type_;
|
||||
-
|
||||
- explicit
|
||||
- type_info_( detail::sp_typeinfo const & type ):
|
||||
- type_(&type)
|
||||
- {
|
||||
- }
|
||||
-
|
||||
- friend
|
||||
- bool
|
||||
- operator<( type_info_ const & a, type_info_ const & b )
|
||||
- {
|
||||
- return 0!=(a.type_->before(*b.type_));
|
||||
- }
|
||||
- };
|
||||
+ typedef boost::typeind::type_index type_info_;
|
||||
}
|
||||
}
|
||||
|
||||
-#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
|
||||
+#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::typeind::type_id<T>()
|
||||
|
||||
#ifndef BOOST_NO_RTTI
|
||||
-#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
|
||||
+#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::typeind::type_id_runtime(x)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
diff --git a/include/boost/exception/diagnostic_information.hpp b/include/boost/exception/diagnostic_information.hpp
|
||||
index 2f5cb88..0f8b5e8 100644
|
||||
--- a/include/boost/exception/diagnostic_information.hpp
|
||||
+++ b/include/boost/exception/diagnostic_information.hpp
|
||||
@@ -151,7 +151,7 @@ boost
|
||||
#ifndef BOOST_NO_RTTI
|
||||
if ( verbose )
|
||||
tmp << std::string("Dynamic exception type: ") <<
|
||||
- /*units::detail::demangle*/((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n';
|
||||
+ /*units::detail::demangle*/((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)))) << '\n';
|
||||
#endif
|
||||
if( with_what && se && verbose )
|
||||
tmp << "std::exception::what: " << wh << '\n';
|
||||
diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp
|
||||
index 9f20a04..53c341f 100644
|
||||
--- a/include/boost/exception/exception.hpp
|
||||
+++ b/include/boost/exception/exception.hpp
|
||||
@@ -12,6 +12,8 @@
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
+#include <boost/exception/detail/type_info.hpp>
|
||||
+
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
@@ -151,7 +153,6 @@ boost
|
||||
exception_detail
|
||||
{
|
||||
class error_info_base;
|
||||
- struct type_info_;
|
||||
|
||||
struct
|
||||
error_info_container
|
||||
diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp
|
||||
index edbf058..e0f4950 100644
|
||||
--- a/include/boost/exception/info.hpp
|
||||
+++ b/include/boost/exception/info.hpp
|
||||
@@ -96,7 +96,7 @@ boost
|
||||
{
|
||||
shared_ptr<error_info_base> const & p = i->second;
|
||||
#ifndef BOOST_NO_RTTI
|
||||
- BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ );
|
||||
+ BOOST_ASSERT(BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
|
||||
#endif
|
||||
return p;
|
||||
}
|
||||
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
|
||||
index d2dfcd6..5bd076d 100644
|
||||
--- a/test/Jamfile.v2
|
||||
+++ b/test/Jamfile.v2
|
||||
@@ -35,7 +35,9 @@ run enable_error_info_test.cpp helper1.cpp ;
|
||||
run throw_exception_test.cpp helper2.cpp ;
|
||||
run errno_test.cpp ;
|
||||
run error_info_test.cpp ;
|
||||
+run error_info_test.cpp : : : <rtti>off : error_info_test_rtti ;
|
||||
run diagnostic_information_test.cpp ;
|
||||
+run diagnostic_information_test.cpp : : : <rtti>off : diagnostic_information_test_rtti ;
|
||||
run refcount_ptr_test.cpp ;
|
||||
run current_exception_cast_test.cpp ;
|
||||
run no_exceptions_test.cpp : : : <exception-handling>off ;
|
||||
--
|
||||
1.8.5.3
|
||||
|
60
patched/boost_function.patch
Normal file
60
patched/boost_function.patch
Normal file
@ -0,0 +1,60 @@
|
||||
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
|
||||
|
26
patched/boost_smart_ptr.patch
Normal file
26
patched/boost_smart_ptr.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 03194eefcb9c3314054855d28bd9a90d3188768d Mon Sep 17 00:00:00 2001
|
||||
From: Antony Polukhin <antoshkka@gmail.com>
|
||||
Date: Thu, 20 Feb 2014 18:50:10 +0400
|
||||
Subject: [PATCH] Use TypeIndex features in Boost.SharedPtr to avoid type_info
|
||||
related bugs
|
||||
|
||||
---
|
||||
include/boost/smart_ptr/detail/sp_counted_impl.hpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/boost/smart_ptr/detail/sp_counted_impl.hpp b/include/boost/smart_ptr/detail/sp_counted_impl.hpp
|
||||
index a7b43ae..5955036 100644
|
||||
--- a/include/boost/smart_ptr/detail/sp_counted_impl.hpp
|
||||
+++ b/include/boost/smart_ptr/detail/sp_counted_impl.hpp
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
|
||||
virtual void * get_deleter( detail::sp_typeinfo const & ti )
|
||||
{
|
||||
- return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
|
||||
+ return ti == boost::typeind::type_id<D>()? &reinterpret_cast<char&>( del ): 0;
|
||||
}
|
||||
|
||||
virtual void * get_untyped_deleter()
|
||||
--
|
||||
1.8.5.3
|
||||
|
58
patched/boost_test.patch
Normal file
58
patched/boost_test.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From fcd4da81d14847272fa888f4e9a54930b48ee95b Mon Sep 17 00:00:00 2001
|
||||
From: Antony Polukhin <antoshkka@gmail.com>
|
||||
Date: Sat, 11 Jan 2014 19:19:20 +0400
|
||||
Subject: [PATCH] Make Boost.Test work with RTTI disabled (fixes #9228)
|
||||
|
||||
---
|
||||
include/boost/test/execution_monitor.hpp | 2 +-
|
||||
include/boost/test/tree/test_case_template.hpp | 13 +++++++++++--
|
||||
2 files changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/boost/test/execution_monitor.hpp b/include/boost/test/execution_monitor.hpp
|
||||
index f6b7681..259f97c 100644
|
||||
--- a/include/boost/test/execution_monitor.hpp
|
||||
+++ b/include/boost/test/execution_monitor.hpp
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
template<typename ExceptionType>
|
||||
void erase_exception_translator( boost::type<ExceptionType>* = 0 )
|
||||
{
|
||||
- m_custom_translators = m_custom_translators->erase<ExceptionType>( m_custom_translators );
|
||||
+ m_custom_translators = m_custom_translators->template erase<ExceptionType>( m_custom_translators );
|
||||
}
|
||||
|
||||
private:
|
||||
diff --git a/include/boost/test/tree/test_case_template.hpp b/include/boost/test/tree/test_case_template.hpp
|
||||
index 9f7466a..b0fa634 100644
|
||||
--- a/include/boost/test/tree/test_case_template.hpp
|
||||
+++ b/include/boost/test/tree/test_case_template.hpp
|
||||
@@ -34,8 +34,13 @@
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/function/function0.hpp>
|
||||
|
||||
-// STL
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
#include <typeinfo> // for typeid
|
||||
+#else
|
||||
+#include <boost/current_function.hpp>
|
||||
+#endif
|
||||
+
|
||||
+// STL
|
||||
#include <string> // for std::string
|
||||
#include <list> // for std::list
|
||||
|
||||
@@ -77,7 +82,11 @@ struct generate_test_case_4_type {
|
||||
std::string full_name;
|
||||
assign_op( full_name, m_test_case_name, 0 );
|
||||
full_name += '<';
|
||||
- full_name += typeid(TestType).name();
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
+ full_name += typeid(TestType).name();
|
||||
+#else
|
||||
+ full_name += BOOST_CURRENT_FUNCTION;
|
||||
+#endif
|
||||
if( boost::is_const<TestType>::value )
|
||||
full_name += " const";
|
||||
full_name += '>';
|
||||
--
|
||||
1.8.5.3
|
||||
|
@ -1,44 +0,0 @@
|
||||
Index: trunk/boost/test/execution_monitor.hpp
|
||||
===================================================================
|
||||
--- trunk/boost/test/execution_monitor.hpp (revision 86235)
|
||||
+++ trunk/boost/test/execution_monitor.hpp (working copy)
|
||||
@@ -261,7 +261,7 @@
|
||||
template<typename ExceptionType>
|
||||
void erase_exception_translator( boost::type<ExceptionType>* = 0 )
|
||||
{
|
||||
- m_custom_translators = m_custom_translators->erase<ExceptionType>( m_custom_translators );
|
||||
+ m_custom_translators = m_custom_translators->template erase<ExceptionType>( m_custom_translators );
|
||||
}
|
||||
|
||||
private:
|
||||
Index: trunk/boost/test/tree/test_case_template.hpp
|
||||
===================================================================
|
||||
--- trunk/boost/test/tree/test_case_template.hpp (revision 86235)
|
||||
+++ trunk/boost/test/tree/test_case_template.hpp (working copy)
|
||||
@@ -34,8 +34,13 @@
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/function/function0.hpp>
|
||||
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
+#include <typeinfo> // for typeid
|
||||
+#else
|
||||
+#include <boost/current_function.hpp>
|
||||
+#endif
|
||||
+
|
||||
// STL
|
||||
-#include <typeinfo> // for typeid
|
||||
#include <string> // for std::string
|
||||
#include <list> // for std::list
|
||||
|
||||
@@ -77,7 +82,11 @@
|
||||
std::string full_name;
|
||||
assign_op( full_name, m_test_case_name, 0 );
|
||||
full_name += '<';
|
||||
+#ifndef BOOST_NO_RTTI
|
||||
full_name += typeid(TestType).name();
|
||||
+#else
|
||||
+ full_name += BOOST_CURRENT_FUNCTION;
|
||||
+#endif
|
||||
if( boost::is_const<TestType>::value )
|
||||
full_name += " const";
|
||||
full_name += '>';
|
@ -1,7 +1,16 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86532)
|
||||
+++ . (working copy)
|
||||
From 21f31f2ceb6d5669ca4e0bcc7b62cf1836eb7002 Mon Sep 17 00:00:00 2001
|
||||
From: Antony Polukhin <antoshkka@gmail.com>
|
||||
Date: Thu, 20 Feb 2014 17:26:24 +0400
|
||||
Subject: [PATCH] Boost.Variant not can work without RTTI support.
|
||||
|
||||
---
|
||||
include/boost/variant/variant.hpp | 19 +++++--------------
|
||||
1 file changed, 5 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/include/boost/variant/variant.hpp b/include/boost/variant/variant.hpp
|
||||
index 46c3ae3..8604ba9 100644
|
||||
--- a/include/boost/variant/variant.hpp
|
||||
+++ b/include/boost/variant/variant.hpp
|
||||
@@ -18,9 +18,7 @@
|
||||
#include <cstddef> // for std::size_t
|
||||
#include <new> // for placement new
|
||||
@ -9,28 +18,29 @@ Index: .
|
||||
-#if !defined(BOOST_NO_TYPEID)
|
||||
-#include <typeinfo> // for typeid, std::type_info
|
||||
-#endif // BOOST_NO_TYPEID
|
||||
+#include "boost/type_index/type_info.hpp"
|
||||
+#include "boost/type_index.hpp"
|
||||
|
||||
#include "boost/variant/detail/config.hpp"
|
||||
#include "boost/mpl/aux_/value_wknd.hpp"
|
||||
@@ -830,23 +828,19 @@
|
||||
@@ -829,24 +827,19 @@ private:
|
||||
//
|
||||
// Generic static visitor that performs a typeid on the value it visits.
|
||||
//
|
||||
|
||||
-
|
||||
-#if !defined(BOOST_NO_TYPEID)
|
||||
-
|
||||
class reflect
|
||||
- : public static_visitor<const std::type_info&>
|
||||
+ : public static_visitor<const boost::type_info&>
|
||||
+ : public static_visitor<const boost::typeind::type_info&>
|
||||
{
|
||||
public: // visitor interfaces
|
||||
|
||||
template <typename T>
|
||||
- const std::type_info& operator()(const T&) const BOOST_NOEXCEPT
|
||||
+ const boost::type_info& operator()(const T&) const BOOST_NOEXCEPT
|
||||
+ const boost::typeind::type_info& operator()(const T&) const BOOST_NOEXCEPT
|
||||
{
|
||||
- return typeid(T);
|
||||
+ return boost::type_id<T>();
|
||||
+ return boost::typeind::type_id<T>().type_info();
|
||||
}
|
||||
|
||||
};
|
||||
@ -40,13 +50,13 @@ Index: .
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// (detail) class comparer
|
||||
//
|
||||
@@ -2155,13 +2149,11 @@
|
||||
@@ -2155,13 +2148,11 @@ public: // queries
|
||||
return false;
|
||||
}
|
||||
|
||||
-#if !defined(BOOST_NO_TYPEID)
|
||||
- const std::type_info& type() const
|
||||
+ const boost::type_info& type() const
|
||||
+ const boost::typeind::type_info& type() const
|
||||
{
|
||||
detail::variant::reflect visitor;
|
||||
return this->apply_visitor(visitor);
|
||||
@ -55,3 +65,6 @@ Index: .
|
||||
|
||||
public: // prevent comparison with foreign types
|
||||
|
||||
--
|
||||
1.8.5.3
|
||||
|
@ -1 +0,0 @@
|
||||
To be honest sp_typeinfo.hpp won't be required with Boost.TypeIndex, because Boost.TypeIndex is more functional then sp_typeinfo and requires much less macro for usage. sp_typeinfo.patch contains a temporary solution for easy migration. Later sp_typeinfo may be removed and BOOST_SP_TYPEID(T) macro deprecated.
|
@ -1,23 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -59,6 +59,10 @@
|
||||
/boost/test//boost_test_exec_monitor/<link>static
|
||||
../build//boost_graph
|
||||
../../regex/build//boost_regex : --log_level=all ]
|
||||
+ [ run graphviz_test.cpp
|
||||
+ /boost/test//boost_test_exec_monitor/<link>static
|
||||
+ ../build//boost_graph
|
||||
+ ../../regex/build//boost_regex : --log_level=all : : <rtti>off : testing_graphviz_no_rtti ]
|
||||
[ run metis_test.cpp : $(METIS_INPUT_FILE) ]
|
||||
[ run gursoy_atun_layout_test.cpp ]
|
||||
[ run layout_test.cpp : : : <test-info>always_show_run_output <toolset>intel:<debug-symbols>off ]
|
||||
@@ -124,6 +128,7 @@
|
||||
[ run two_graphs_common_spanning_trees_test.cpp ]
|
||||
[ run random_spanning_tree_test.cpp ../build//boost_graph ]
|
||||
[ run graphml_test.cpp ../build//boost_graph : : "graphml_test.xml" ]
|
||||
+ [ run graphml_test.cpp ../build//boost_graph : : "graphml_test.xml" : <rtti>off : testing_graphml_no_rtti ]
|
||||
[ run mas_test.cpp ../../test/build//boost_unit_test_framework/<link>static : $(TEST_DIR) ]
|
||||
[ run stoer_wagner_test.cpp ../../test/build//boost_unit_test_framework/<link>static : $(TEST_DIR) ]
|
||||
[ compile filtered_graph_properties_dijkstra.cpp ]
|
@ -1,83 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/graph/dll_import_export.hpp>
|
||||
#include <boost/graph/graphviz.hpp> // for exceptions
|
||||
-#include <typeinfo>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
@@ -218,16 +218,16 @@
|
||||
class get_type_name
|
||||
{
|
||||
public:
|
||||
- get_type_name(const std::type_info& type, const char** type_names, std::string& type_name)
|
||||
+ get_type_name(const boost::type_info& type, const char** type_names, std::string& type_name)
|
||||
: m_type(type), m_type_names(type_names), m_type_name(type_name) {}
|
||||
template <typename Type>
|
||||
void operator()(Type)
|
||||
{
|
||||
- if (typeid(Type) == m_type)
|
||||
+ if (boost::type_id<Type>() == m_type)
|
||||
m_type_name = m_type_names[mpl::find<Types,Type>::type::pos::value];
|
||||
}
|
||||
private:
|
||||
- const std::type_info &m_type;
|
||||
+ const boost::type_info &m_type;
|
||||
const char** m_type_names;
|
||||
std::string &m_type_name;
|
||||
};
|
||||
@@ -262,18 +262,18 @@
|
||||
for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
|
||||
{
|
||||
std::string key_id = "key" + lexical_cast<std::string>(key_count++);
|
||||
- if (i->second->key() == typeid(Graph*))
|
||||
+ if (i->second->key() == boost::type_id<Graph*>())
|
||||
graph_key_ids[i->first] = key_id;
|
||||
- else if (i->second->key() == typeid(vertex_descriptor))
|
||||
+ else if (i->second->key() == boost::type_id<vertex_descriptor>())
|
||||
vertex_key_ids[i->first] = key_id;
|
||||
- else if (i->second->key() == typeid(edge_descriptor))
|
||||
+ else if (i->second->key() == boost::type_id<edge_descriptor>())
|
||||
edge_key_ids[i->first] = key_id;
|
||||
else
|
||||
continue;
|
||||
std::string type_name = "string";
|
||||
mpl::for_each<value_types>(get_type_name<value_types>(i->second->value(), type_names, type_name));
|
||||
out << " <key id=\"" << encode_char_entities(key_id) << "\" for=\""
|
||||
- << (i->second->key() == typeid(Graph*) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\""
|
||||
+ << (i->second->key() == boost::type_id<Graph*>() ? "graph" : (i->second->key() == boost::type_id<vertex_descriptor>() ? "node" : "edge")) << "\""
|
||||
<< " attr.name=\"" << i->first << "\""
|
||||
<< " attr.type=\"" << type_name << "\""
|
||||
<< " />\n";
|
||||
@@ -287,7 +287,7 @@
|
||||
// Output graph data
|
||||
for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
|
||||
{
|
||||
- if (i->second->key() == typeid(Graph*))
|
||||
+ if (i->second->key() == boost::type_id<Graph*>())
|
||||
{
|
||||
// The const_cast here is just to get typeid correct for property
|
||||
// map key; the graph should not be mutated using it.
|
||||
@@ -304,7 +304,7 @@
|
||||
// Output data
|
||||
for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
|
||||
{
|
||||
- if (i->second->key() == typeid(vertex_descriptor))
|
||||
+ if (i->second->key() == boost::type_id<vertex_descriptor>())
|
||||
{
|
||||
out << " <data key=\"" << vertex_key_ids[i->first] << "\">"
|
||||
<< encode_char_entities(i->second->get_string(*v)) << "</data>\n";
|
||||
@@ -325,7 +325,7 @@
|
||||
// Output data
|
||||
for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i)
|
||||
{
|
||||
- if (i->second->key() == typeid(edge_descriptor))
|
||||
+ if (i->second->key() == boost::type_id<edge_descriptor>())
|
||||
{
|
||||
out << " <data key=\"" << edge_key_ids[i->first] << "\">"
|
||||
<< encode_char_entities(i->second->get_string(*e)) << "</data>\n";
|
@ -1,30 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdio.h> // for FILE
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
#include <boost/property_map/property_map.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
@@ -489,7 +490,7 @@
|
||||
bool first = true;
|
||||
for (dynamic_properties::const_iterator i = dp->begin();
|
||||
i != dp->end(); ++i) {
|
||||
- if (typeid(key) == i->second->key()) {
|
||||
+ if (boost::type_id<Descriptor>() == i->second->key()) {
|
||||
if (first) out << " [";
|
||||
else out << ", ";
|
||||
first = false;
|
||||
@@ -518,7 +519,7 @@
|
||||
bool first = true;
|
||||
for (dynamic_properties::const_iterator i = dp->begin();
|
||||
i != dp->end(); ++i) {
|
||||
- if (typeid(key) == i->second->key()
|
||||
+ if (boost::type_id<Descriptor>() == i->second->key()
|
||||
&& i->first != *node_id) {
|
||||
if (first) out << " [";
|
||||
else out << ", ";
|
@ -1,40 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <boost/iterator/counting_iterator.hpp>
|
||||
#include <boost/random/uniform_int.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
-#include <typeinfo>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
|
||||
namespace boost { namespace parallel {
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
virtual void* address() { return &distribution_; }
|
||||
virtual const void* address() const { return &distribution_; }
|
||||
- virtual const std::type_info& type() const { return typeid(Distribution); }
|
||||
+ virtual const boost::type_info& type() const { return boost::type_id<Distribution>(); }
|
||||
|
||||
private:
|
||||
Distribution distribution_;
|
||||
@@ -106,7 +106,7 @@
|
||||
template<typename T>
|
||||
T* as()
|
||||
{
|
||||
- if (distribution_->type() == typeid(T))
|
||||
+ if (distribution_->type() == boost::type_id<T>())
|
||||
return static_cast<T*>(distribution_->address());
|
||||
else
|
||||
return 0;
|
||||
@@ -115,7 +115,7 @@
|
||||
template<typename T>
|
||||
const T* as() const
|
||||
{
|
||||
- if (distribution_->type() == typeid(T))
|
||||
+ if (distribution_->type() == boost::type_id<T>())
|
||||
return static_cast<T*>(distribution_->address());
|
||||
else
|
||||
return 0;
|
@ -1,3 +0,0 @@
|
||||
This patch requires additional care.
|
||||
|
||||
It works and tested through the Boost.Graph tests, but in some places `typeid(variable)` were replaced with `typeid(Type)`.
|
@ -1,80 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <boost/any.hpp>
|
||||
#include <boost/function/function3.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
-#include <typeinfo>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
@@ -60,8 +60,8 @@
|
||||
virtual boost::any get(const any& key) = 0;
|
||||
virtual std::string get_string(const any& key) = 0;
|
||||
virtual void put(const any& key, const any& value) = 0;
|
||||
- virtual const std::type_info& key() const = 0;
|
||||
- virtual const std::type_info& value() const = 0;
|
||||
+ virtual const boost::type_info& key() const = 0;
|
||||
+ virtual const boost::type_info& value() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
using boost::put;
|
||||
|
||||
key_type key = any_cast<key_type>(in_key);
|
||||
- if (in_value.type() == typeid(value_type)) {
|
||||
+ if (in_value.type() == boost::type_id<value_type>()) {
|
||||
put(property_map_, key, any_cast<value_type>(in_value));
|
||||
} else {
|
||||
// if in_value is an empty string, put a default constructed value_type.
|
||||
@@ -188,8 +188,8 @@
|
||||
writable_property_map_tag*>::value)>());
|
||||
}
|
||||
|
||||
- virtual const std::type_info& key() const { return typeid(key_type); }
|
||||
- virtual const std::type_info& value() const { return typeid(value_type); }
|
||||
+ virtual const boost::type_info& key() const { return boost::type_id<key_type>(); }
|
||||
+ virtual const boost::type_info& value() const { return boost::type_id<value_type>(); }
|
||||
|
||||
PropertyMap& base() { return property_map_; }
|
||||
const PropertyMap& base() const { return property_map_; }
|
||||
@@ -283,7 +283,7 @@
|
||||
{
|
||||
for (dynamic_properties::iterator i = dp.lower_bound(name);
|
||||
i != dp.end() && i->first == name; ++i) {
|
||||
- if (i->second->key() == typeid(key)) {
|
||||
+ if (i->second->key() == boost::type_id<Key>()) {
|
||||
i->second->put(key, value);
|
||||
return true;
|
||||
}
|
||||
@@ -305,7 +305,7 @@
|
||||
{
|
||||
for (dynamic_properties::const_iterator i = dp.lower_bound(name);
|
||||
i != dp.end() && i->first == name; ++i) {
|
||||
- if (i->second->key() == typeid(key))
|
||||
+ if (i->second->key() == boost::type_id<Key>())
|
||||
return any_cast<Value>(i->second->get(key));
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
{
|
||||
for (dynamic_properties::const_iterator i = dp.lower_bound(name);
|
||||
i != dp.end() && i->first == name; ++i) {
|
||||
- if (i->second->key() == typeid(key))
|
||||
+ if (i->second->key() == boost::type_id<Key>())
|
||||
return any_cast<Value>(i->second->get(key));
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
{
|
||||
for (dynamic_properties::const_iterator i = dp.lower_bound(name);
|
||||
i != dp.end() && i->first == name; ++i) {
|
||||
- if (i->second->key() == typeid(key))
|
||||
+ if (i->second->key() == boost::type_id<Key>())
|
||||
return i->second->get_string(key);
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -650,7 +650,7 @@
|
||||
}
|
||||
BOOST_PROPERTY_TREE_THROW(ptree_bad_data(
|
||||
std::string("conversion of data to type \"") +
|
||||
- typeid(Type).name() + "\" failed", data()));
|
||||
+ boost::type_id<Type>().name_demangled() + "\" failed", data()));
|
||||
}
|
||||
|
||||
template<class K, class D, class C>
|
||||
@@ -805,7 +805,7 @@
|
||||
data() = *o;
|
||||
} else {
|
||||
BOOST_PROPERTY_TREE_THROW(ptree_bad_data(
|
||||
- std::string("conversion of type \"") + typeid(Type).name() +
|
||||
+ std::string("conversion of type \"") + boost::type_id<Type>().name_demangled() +
|
||||
"\" to data failed", boost::any()));
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86532)
|
||||
+++ . (working copy)
|
||||
@@ -53,6 +53,7 @@
|
||||
<toolset>clang:<cxxflags>-fno-exceptions
|
||||
: variant_noexcept_test
|
||||
]
|
||||
+ [ run recursive_variant_test.cpp : : : <rtti>off : variant_nortti_test ]
|
||||
[ run variant_swap_test.cpp ]
|
||||
;
|
||||
|
@ -1,38 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -19,7 +19,7 @@
|
||||
#endif
|
||||
#include <stack>
|
||||
#include <limits>
|
||||
-#include <typeinfo>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/version.hpp>
|
||||
@@ -144,7 +144,7 @@
|
||||
explicit xpression_linker(Traits const &tr)
|
||||
: back_stack_()
|
||||
, traits_(&tr)
|
||||
- , traits_type_(&typeid(Traits))
|
||||
+ , traits_type_(&boost::type_id<Traits>())
|
||||
, has_backrefs_(false)
|
||||
{
|
||||
}
|
||||
@@ -310,13 +310,13 @@
|
||||
template<typename Traits>
|
||||
Traits const &get_traits() const
|
||||
{
|
||||
- BOOST_ASSERT(*this->traits_type_ == typeid(Traits));
|
||||
+ BOOST_ASSERT(*this->traits_type_ == boost::type_id<Traits>());
|
||||
return *static_cast<Traits const *>(this->traits_);
|
||||
}
|
||||
|
||||
std::stack<void const *> back_stack_;
|
||||
void const *traits_;
|
||||
- std::type_info const *traits_type_;
|
||||
+ boost::type_info const *traits_type_;
|
||||
bool has_backrefs_;
|
||||
};
|
||||
|
@ -1,33 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -25,9 +25,9 @@
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
-#include <typeinfo>
|
||||
#include <algorithm>
|
||||
#include <boost/config.hpp>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
@@ -72,7 +72,7 @@
|
||||
//
|
||||
struct type_info_less
|
||||
{
|
||||
- bool operator()(std::type_info const *left, std::type_info const *right) const
|
||||
+ bool operator()(boost::type_info const *left, boost::type_info const *right) const
|
||||
{
|
||||
return 0 != left->before(*right);
|
||||
}
|
||||
@@ -679,7 +679,7 @@
|
||||
typedef typename proto::result_of::value<right_type>::type arg_right_type;
|
||||
BOOST_MPL_ASSERT((proto::matches<Arg, detail::ActionArgBinding>));
|
||||
BOOST_MPL_ASSERT((is_same<typename arg_left_type::type, arg_right_type>));
|
||||
- this->args_[&typeid(proto::value(proto::left(arg)))] = &proto::value(proto::right(arg));
|
||||
+ this->args_[&boost::type_id<arg_left_type>()] = &proto::value(proto::right(arg));
|
||||
return *this;
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
Index: .
|
||||
===================================================================
|
||||
--- . (revision 86520)
|
||||
+++ . (working copy)
|
||||
@@ -14,7 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
-#include <typeinfo>
|
||||
+#include <boost/type_index/type_info.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
@@ -250,9 +250,9 @@
|
||||
if(0 == this->traits_)
|
||||
{
|
||||
this->traits_ = &tr;
|
||||
- this->traits_type_ = &typeid(Traits);
|
||||
+ this->traits_type_ = &boost::type_id<Traits>();
|
||||
}
|
||||
- else if(*this->traits_type_ != typeid(Traits) || this->get_traits_<Traits>() != tr)
|
||||
+ else if(*this->traits_type_ != boost::type_id<Traits>() || this->get_traits_<Traits>() != tr)
|
||||
{
|
||||
this->fail(); // traits mis-match! set all and bail
|
||||
}
|
||||
@@ -265,7 +265,7 @@
|
||||
template<typename Traits>
|
||||
Traits const &get_traits_() const
|
||||
{
|
||||
- BOOST_ASSERT(!!(*this->traits_type_ == typeid(Traits)));
|
||||
+ BOOST_ASSERT(!!(*this->traits_type_ == boost::type_id<Traits>()));
|
||||
return *static_cast<Traits const *>(this->traits_);
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@
|
||||
bool str_icase_;
|
||||
bool line_start_;
|
||||
void const *traits_;
|
||||
- std::type_info const *traits_type_;
|
||||
+ boost::type_info const *traits_type_;
|
||||
int leading_simple_repeat_;
|
||||
bool has_backrefs_;
|
||||
};
|
72
todos.txt
72
todos.txt
@ -1,72 +0,0 @@
|
||||
Sketch of TypeIndex v3 library interface:
|
||||
|
||||
// boost/type_index/type_index_base.hpp
|
||||
namespace boost{ namespace typeind {
|
||||
|
||||
namespce detail {
|
||||
|
||||
template <class TypeInfo>
|
||||
class type_index_base
|
||||
const TypeInfo* data_;
|
||||
|
||||
public:
|
||||
type_index_base(const TypeInfo&);
|
||||
|
||||
const char* raw_name() const noexcept;
|
||||
const char* name() const noexcept;
|
||||
const char* pretty_name() const;
|
||||
std::size_t hash_value() const noexcept;
|
||||
const TypeInfo& type_info() const noexcept;
|
||||
|
||||
// comparison operators
|
||||
};
|
||||
|
||||
}}} // namespace boost::typeind::detail
|
||||
|
||||
|
||||
// boost/type_index.hpp
|
||||
/// Contians core functionality for everyday use
|
||||
namespace boost{ namespace typeind {
|
||||
|
||||
// MSVC is capable of calling typeid(T) even when RTTI is off
|
||||
#if (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC)
|
||||
typedef std::type_info type_info; // RTTI on/off dependent
|
||||
typedef type_index_base<type_info> type_index;
|
||||
#else
|
||||
#else
|
||||
#endif
|
||||
|
||||
inline bool is_equal(const type_info&, const type_info&) noexcept;
|
||||
|
||||
template <class T>
|
||||
type_index type_id() noexcept;
|
||||
|
||||
template <class T>
|
||||
type_index type_id_with_cvr() noexcept;
|
||||
|
||||
template <class T>
|
||||
type_index type_id_runtime(const T&) noexcept;
|
||||
|
||||
template <class T>
|
||||
type_index type_id_runtime(const T*) noexcept;
|
||||
|
||||
/* macro that must be put inside class to allow `type_id_runtime` calls with RTTI disabled */
|
||||
/// Empty if RTTI is on
|
||||
#define BOOST_TYPE_INDEX_REGISTER_CLASS
|
||||
|
||||
}} // namespace boost::typeind
|
||||
|
||||
// boost/type_index/ctti.hpp
|
||||
/// Contians minimal functionality required by boost/type_index.hpp with RTTI off
|
||||
namespace boost { namespace detail {
|
||||
template <class T>
|
||||
struct ctti {
|
||||
/// Returns raw name. Must be as short, as possible, to avoid code bloat
|
||||
static const char* n() noexcept;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
namespace typeind {
|
||||
// Will be used instead of std::type_info when RTTI is off
|
||||
class ctti_data; // POD. Interface is close to std::type_info
|
||||
}}
|
Reference in New Issue
Block a user