Use hash_fwd header and use new paths to boost::hash*

This commit is contained in:
Antony Polukhin
2018-01-14 23:41:33 +03:00
parent 1a7226bc0f
commit 82ed016577
5 changed files with 12 additions and 20 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2013-2014 Antony Polukhin
// Copyright 2013-2018 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@ -83,9 +83,9 @@ namespace my_namespace { namespace detail {
/*`
Since we are not going to override `type_index_facade::hash_code()` we must additionally include
`<boost/functional/hash.hpp>`.
`<boost/container_hash/hash.hpp>`.
*/
#include <boost/functional/hash.hpp>
#include <boost/container_hash/hash.hpp>
/*`
See implementation of `my_type_index`:

View File

@ -1,5 +1,5 @@
//
// Copyright (c) Antony Polukhin, 2012-2014.
// Copyright (c) Antony Polukhin, 2012-2018.
//
// 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)

View File

@ -1,5 +1,5 @@
//
// Copyright (c) Antony Polukhin, 2013-2016.
// Copyright (c) Antony Polukhin, 2013-2018.
//
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -22,7 +22,7 @@
#include <boost/type_index/detail/compile_time_type_info.hpp>
#include <cstring>
#include <boost/functional/hash.hpp>
#include <boost/container_hash/hash.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>

View File

@ -1,5 +1,5 @@
//
// Copyright (c) Antony Polukhin, 2013-2017.
// Copyright (c) Antony Polukhin, 2013-2018.
//
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -40,11 +40,7 @@
#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
#include <boost/container_hash/hash.hpp>
#if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \
|| (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744)

View File

@ -1,5 +1,5 @@
//
// Copyright (c) Antony Polukhin, 2013-2015.
// Copyright (c) Antony Polukhin, 2013-2018.
//
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -10,6 +10,7 @@
#define BOOST_TYPE_INDEX_TYPE_INDEX_FACADE_HPP
#include <boost/config.hpp>
#include <boost/container_hash/hash_fwd.hpp>
#include <string>
#include <cstring>
@ -25,11 +26,6 @@
# pragma once
#endif
// Forward declaration from #include <boost/functional/hash_fwd.hpp>
namespace boost {
template <class It> std::size_t hash_range(It, It);
}
namespace boost { namespace typeindex {
/// \class type_index_facade
@ -103,7 +99,7 @@ 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 Derived class header \b must include <boost/functional/hash.hpp>, \b unless this function is redefined in
/// \note Derived class header \b must include <boost/container_hash/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();
@ -289,7 +285,7 @@ inline std::basic_ostream<CharT, TriatT>& operator<<(
#endif // BOOST_NO_IOSTREAM
/// This free function is used by Boost's unordered containers.
/// \note <boost/functional/hash.hpp> has to be included if this function is used.
/// \note <boost/container_hash/hash.hpp> has to be included if this function is used.
template <class Derived, class TypeInfo>
inline std::size_t hash_value(const type_index_facade<Derived, TypeInfo>& lhs) BOOST_NOEXCEPT {
return static_cast<Derived const&>(lhs).hash_code();