From 9ea436c4d3ab8304592cce4a93754cba7e790eef Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Wed, 13 Nov 2013 11:01:54 +0400 Subject: [PATCH] Applied one more part of changes proposed by Vicente J. Botet Escriba --- boost/type_index/template_info.hpp | 10 +++++++--- boost/type_index/type_info.hpp | 8 ++++++++ libs/type_index/doc/type_index.qbk | 8 ++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/boost/type_index/template_info.hpp b/boost/type_index/template_info.hpp index 15c6e86..5c88244 100644 --- a/boost/type_index/template_info.hpp +++ b/boost/type_index/template_info.hpp @@ -188,7 +188,9 @@ public: {} /// Factory method for constructing boost::template_info instance for type T. - /// Strips const, volatile and & modifiers from T + /// Strips const, volatile and & modifiers from T. + /// + /// Works exactly like boost::template_id(). template static const template_info& construct(){ typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; @@ -205,7 +207,9 @@ public: } /// Factory method for constructing template_info instance for type T. - /// Does not strip const, volatile and & modifiers from T + /// Does not strip const, volatile and & modifiers from T. + /// + /// Works exactly like boost::template_id_with_cvr(). template static const template_info& construct_with_cvr() { # if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ @@ -274,7 +278,7 @@ inline const template_info& template_id() BOOST_NOEXCEPT { return template_info::construct(); } -/// Factory method for constructing template_info instance for type T. +/// Method for constructing template_info instance for type T. /// Does not strip const, volatile and & modifiers from T. /// If T has no const, volatile, & and && modifiers, then returns exactly /// the same result as in case of calling `template_id()`. diff --git a/boost/type_index/type_info.hpp b/boost/type_index/type_info.hpp index 2f3b319..5ac7ca4 100644 --- a/boost/type_index/type_info.hpp +++ b/boost/type_index/type_info.hpp @@ -104,6 +104,8 @@ public: /// Factory method for constructing boost::type_info instance for type T. /// Strips const, volatile and & modifiers from T. + /// + /// Works exactly like boost::type_id(). template static const boost::type_info& construct() BOOST_NOEXCEPT { typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; @@ -122,6 +124,8 @@ public: /// Does not strip const, volatile, & and && modifiers from T. /// If T has no const, volatile, & and && modifiers, then returns exactly /// the same result as in case of calling `construct()`. + /// + /// Works exactly like boost::type_id_with_cvr(). template static const boost::type_info& construct_with_cvr() BOOST_NOEXCEPT { typedef typename boost::mpl::if_c< @@ -137,6 +141,8 @@ public: /// Factory function, that works exactly like C++ typeid(rtti_val) call, but returns boost::type_info. /// This method available only with RTTI enabled. + /// + /// Same as boost::type_id_rtti_only(). template static const type_info& construct_rtti_only(T& rtti_val) BOOST_NOEXCEPT { #ifdef BOOST_NO_RTTI @@ -148,6 +154,8 @@ public: /// Factory function, that works exactly like C++ typeid(rtti_val) call, but returns boost::type_info. /// This method available only with RTTI enabled. + /// + /// Same as boost::type_id_rtti_only(). template static const type_info& construct_rtti_only(T* rtti_val) { #ifdef BOOST_NO_RTTI diff --git a/libs/type_index/doc/type_index.qbk b/libs/type_index/doc/type_index.qbk index 692bb25..58ab87a 100644 --- a/libs/type_index/doc/type_index.qbk +++ b/libs/type_index/doc/type_index.qbk @@ -235,14 +235,14 @@ to `sizeof(">::n(void)") - 1` Linking a binary from source files that were compiled with different RTTI flags is not a very good idea and may lead to a lot of surprises. However if there is a very strong need, TypeIndex library -provides a solution for mixing sources: just define `BOOST_TYPE_INDEX_FORCE_NORTTI_COMPATIBILITY` +provides a solution for mixing sources: just define `BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY` macro. This would lead to usage of `boost::template_index` instead of `boost::type_index` class and `boost::template_info` instead of `boost::type_info` class. -[note Do not forget to rebuild *all* the projects with `BOOST_TYPE_INDEX_FORCE_NORTTI_COMPATIBILITY` macro defined ] +[note Do not forget to rebuild *all* the projects with `BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY` macro defined ] You must know that linking RTTI on and RTTI off binaries may succeed even without defining the -`BOOST_TYPE_INDEX_FORCE_NORTTI_COMPATIBILITY` macro, but that does not mean that you'll get a +`BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY` macro, but that does not mean that you'll get a working binary. Such actions may break the One Definition Rule. Take a look at the table below, that shows how the `boost::type_index get_integer();` function will look like with different RTTI flags: @@ -255,7 +255,7 @@ RTTI flags: Such differences are usually not detected by linker and lead to errors at runtime. [warning - Even with `BOOST_TYPE_INDEX_FORCE_NORTTI_COMPATIBILITY` defined there is no guarantee + Even with `BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY` defined there is no guarantee that everything will be OK. Libraries that use their own workarounds for disabled RTTI may fail to link or to work correctly. ]