summaryrefslogtreecommitdiff
path: root/boost/type_index
diff options
context:
space:
mode:
Diffstat (limited to 'boost/type_index')
-rw-r--r--boost/type_index/ctti_type_index.hpp1
-rw-r--r--boost/type_index/detail/compile_time_type_info.hpp16
-rw-r--r--boost/type_index/stl_type_index.hpp10
-rw-r--r--boost/type_index/type_index_facade.hpp3
4 files changed, 21 insertions, 9 deletions
diff --git a/boost/type_index/ctti_type_index.hpp b/boost/type_index/ctti_type_index.hpp
index 611ad92e11..6832adeaf7 100644
--- a/boost/type_index/ctti_type_index.hpp
+++ b/boost/type_index/ctti_type_index.hpp
@@ -22,6 +22,7 @@
#include <boost/type_index/detail/compile_time_type_info.hpp>
#include <cstring>
+#include <boost/functional/hash.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
diff --git a/boost/type_index/detail/compile_time_type_info.hpp b/boost/type_index/detail/compile_time_type_info.hpp
index a2a89ae136..4eb2017ffc 100644
--- a/boost/type_index/detail/compile_time_type_info.hpp
+++ b/boost/type_index/detail/compile_time_type_info.hpp
@@ -11,7 +11,7 @@
/// \file compile_time_type_info.hpp
/// \brief Contains helper macros and implementation details of boost::typeindex::ctti_type_index.
-/// Not intended for inclusion from user's code.
+/// Not intended for inclusion from user's code.
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
@@ -59,9 +59,12 @@
// sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "int>::n() [T = int"
// note: checked on 3.1, 3.4
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ")
-#elif defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR)
- // sizeof("static contexpr char boost::detail::ctti<T>::s() [with unsigned int I = 0u; T = ") - 1, sizeof("]") - 1
+#elif defined(__GNUC__) && (__GNUC__ < 7) && !defined(BOOST_NO_CXX14_CONSTEXPR)
+ // sizeof("static constexpr char boost::detail::ctti<T>::s() [with unsigned int I = 0u; T = ") - 1, sizeof("]") - 1
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(81, 1, false, "")
+#elif defined(__GNUC__) && (__GNUC__ >= 7) && !defined(BOOST_NO_CXX14_CONSTEXPR)
+ // sizeof("static constexpr char boost::detail::ctti<T>::s() [with unsigned int I = 0; T = ") - 1, sizeof("]") - 1
+ BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(80, 1, false, "")
#elif defined(__GNUC__) && defined(BOOST_NO_CXX14_CONSTEXPR)
// sizeof("static const char* boost::detail::ctti<T>::n() [with T = ") - 1, sizeof("]") - 1
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "")
@@ -72,7 +75,7 @@
#undef BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS
-namespace boost { namespace typeindex { namespace detail {
+namespace boost { namespace typeindex { namespace detail {
template <bool Condition>
BOOST_CXX14_CONSTEXPR inline void assert_compile_time_legths() BOOST_NOEXCEPT {
BOOST_STATIC_ASSERT_MSG(
@@ -149,7 +152,7 @@ namespace boost { namespace typeindex { namespace detail {
BOOST_CXX14_CONSTEXPR inline const char* skip_begining(const char* begin) BOOST_NOEXCEPT {
assert_compile_time_legths<(ArrayLength > ctti_skip_size_at_begin + ctti_skip_size_at_end)>();
return skip_begining_runtime<ArrayLength - ctti_skip_size_at_begin>(
- begin + ctti_skip_size_at_begin,
+ begin + ctti_skip_size_at_begin,
boost::mpl::bool_<ctti_skip_more_at_runtime>()
);
}
@@ -203,7 +206,7 @@ namespace boost { namespace detail {
/// This name must be as short as possible, to avoid code bloat
template <class T>
struct ctti {
-
+
#if !defined(__clang__) && defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR)
//helper functions
template <unsigned int I>
@@ -286,4 +289,3 @@ struct ctti {
}} // namespace boost::detail
#endif // BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP
-
diff --git a/boost/type_index/stl_type_index.hpp b/boost/type_index/stl_type_index.hpp
index be28889962..dcc532d03b 100644
--- a/boost/type_index/stl_type_index.hpp
+++ b/boost/type_index/stl_type_index.hpp
@@ -40,6 +40,12 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
+#if !((defined(_MSC_VER) && _MSC_VER > 1600) \
+ || (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__)) \
+ || (defined(__GNUC__) && __GNUC__ > 4 && __cplusplus >= 201103 ))
+# include <boost/functional/hash.hpp>
+#endif
+
#if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \
|| (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744)
# include <boost/type_traits/is_signed.hpp>
@@ -174,7 +180,9 @@ inline std::string stl_type_index::pretty_name() const {
inline std::size_t stl_type_index::hash_code() const BOOST_NOEXCEPT {
-#if (defined(_MSC_VER) && _MSC_VER > 1600) || (__GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__))
+#if (defined(_MSC_VER) && _MSC_VER > 1600) \
+ || (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__)) \
+ || (defined(__GNUC__) && __GNUC__ > 4 && __cplusplus >= 201103)
return data_->hash_code();
#else
return boost::hash_range(raw_name(), raw_name() + std::strlen(raw_name()));
diff --git a/boost/type_index/type_index_facade.hpp b/boost/type_index/type_index_facade.hpp
index dd35df2caa..110000c33d 100644
--- a/boost/type_index/type_index_facade.hpp
+++ b/boost/type_index/type_index_facade.hpp
@@ -103,7 +103,8 @@ public:
/// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw.
/// \return Hash code of a type. By default hashes types by raw_name().
- /// \note <boost/functional/hash.hpp> has to be included if this function is used.
+ /// \note Derived class header \b must include <boost/functional/hash.hpp>, \b unless this function is redefined in
+ /// Derived class to not use boost::hash_range().
inline std::size_t hash_code() const BOOST_NOEXCEPT {
const char* const name_raw = derived().raw_name();
return boost::hash_range(name_raw, name_raw + std::strlen(name_raw));