Applied one more part of changes proposed by Vicente J. Botet Escriba

This commit is contained in:
Antony Polukhin
2013-11-13 11:01:54 +04:00
parent 9e4e48a9b3
commit 9ea436c4d3
3 changed files with 19 additions and 7 deletions

View File

@ -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 <class T>
static const template_info& construct(){
typedef BOOST_DEDUCED_TYPENAME boost::remove_reference<T>::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 <class T>
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<T>();
}
/// 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<T>()`.

View File

@ -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 <class T>
static const boost::type_info& construct() BOOST_NOEXCEPT {
typedef BOOST_DEDUCED_TYPENAME boost::remove_reference<T>::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<T>()`.
///
/// Works exactly like boost::type_id_with_cvr().
template <class T>
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 <class T>
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 <class T>
static const type_info& construct_rtti_only(T* rtti_val) {
#ifdef BOOST_NO_RTTI

View File

@ -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.
]