forked from boostorg/unordered
Move config and declaration to the start of implementataion.hpp
This commit is contained in:
@ -46,10 +46,76 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
||||||
|
#include <type_traits>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Configuration
|
||||||
|
//
|
||||||
|
// Unless documented elsewhere these configuration macros should be considered
|
||||||
|
// an implementation detail, I'll try not to break them, but you never know.
|
||||||
|
|
||||||
|
// BOOST_UNORDERED_EMPLACE_LIMIT = The maximum number of parameters in emplace
|
||||||
|
// (not including things like hints). Don't set it to a lower value, as that
|
||||||
|
// might break something.
|
||||||
|
|
||||||
|
#if !defined BOOST_UNORDERED_EMPLACE_LIMIT
|
||||||
|
#define BOOST_UNORDERED_EMPLACE_LIMIT 11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// BOOST_UNORDERED_USE_ALLOCATOR_TRAITS - Pick which version of
|
||||||
|
// allocator_traits to use.
|
||||||
|
//
|
||||||
|
// 0 = Own partial implementation
|
||||||
|
// 1 = std::allocator_traits
|
||||||
|
// 2 = boost::container::allocator_traits
|
||||||
|
|
||||||
|
#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS)
|
||||||
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
|
#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 1
|
||||||
|
#elif defined(BOOST_MSVC)
|
||||||
|
#if BOOST_MSVC < 1400
|
||||||
|
// Use container's allocator_traits for older versions of Visual
|
||||||
|
// C++ as I don't test with them.
|
||||||
|
#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 2
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS)
|
||||||
|
#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
namespace unordered {
|
||||||
|
namespace iterator_detail {
|
||||||
|
template <typename Node> struct iterator;
|
||||||
|
template <typename Node> struct c_iterator;
|
||||||
|
template <typename Node, typename Policy> struct l_iterator;
|
||||||
|
template <typename Node, typename Policy> struct cl_iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace unordered {
|
namespace unordered {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
template <typename Types> struct table;
|
||||||
|
template <typename NodePointer> struct bucket;
|
||||||
|
struct ptr_bucket;
|
||||||
|
template <typename Types> struct table_impl;
|
||||||
|
template <typename Types> struct grouped_table_impl;
|
||||||
|
|
||||||
|
template <typename A, typename T> struct unique_node;
|
||||||
|
template <typename T> struct ptr_node;
|
||||||
|
template <typename Types> struct table_impl;
|
||||||
|
|
||||||
|
template <typename A, typename T> struct grouped_node;
|
||||||
|
template <typename T> struct grouped_ptr_node;
|
||||||
|
template <typename Types> struct grouped_table_impl;
|
||||||
|
|
||||||
static const float minimum_max_load_factor = 1e-3f;
|
static const float minimum_max_load_factor = 1e-3f;
|
||||||
static const std::size_t default_bucket_count = 11;
|
static const std::size_t default_bucket_count = 11;
|
||||||
struct move_tag
|
struct move_tag
|
||||||
@ -270,9 +336,6 @@ struct compressed
|
|||||||
// move_assign explicit.
|
// move_assign explicit.
|
||||||
compressed& operator=(compressed const&);
|
compressed& operator=(compressed const&);
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
@ -282,13 +345,6 @@ struct compressed
|
|||||||
// will be default-initialized.
|
// will be default-initialized.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Maximum number of arguments supported by emplace + 1.
|
|
||||||
#define BOOST_UNORDERED_EMPLACE_LIMIT 11
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace unordered {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Bits and pieces for implementing traits
|
// Bits and pieces for implementing traits
|
||||||
|
|
||||||
@ -483,33 +539,6 @@ BOOST_PP_REPEAT_FROM_TO(
|
|||||||
#undef BOOST_UNORDERED_EARGS_MEMBER
|
#undef BOOST_UNORDERED_EARGS_MEMBER
|
||||||
#undef BOOST_UNORDERED_EARGS_INIT
|
#undef BOOST_UNORDERED_EARGS_INIT
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Pick which version of allocator_traits to use
|
|
||||||
//
|
|
||||||
// 0 = Own partial implementation
|
|
||||||
// 1 = std::allocator_traits
|
|
||||||
// 2 = boost::container::allocator_traits
|
|
||||||
|
|
||||||
#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS)
|
|
||||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
|
||||||
#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 1
|
|
||||||
#elif defined(BOOST_MSVC)
|
|
||||||
#if BOOST_MSVC < 1400
|
|
||||||
// Use container's allocator_traits for older versions of Visual
|
|
||||||
// C++ as I don't test with them.
|
|
||||||
#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 2
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS)
|
|
||||||
#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -517,14 +546,6 @@ BOOST_PP_REPEAT_FROM_TO(
|
|||||||
// Some utilities for implementing allocator_traits, but useful elsewhere so
|
// Some utilities for implementing allocator_traits, but useful elsewhere so
|
||||||
// they're always defined.
|
// they're always defined.
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
|
||||||
#include <type_traits>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace unordered {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Integral_constrant, true_type, false_type
|
// Integral_constrant, true_type, false_type
|
||||||
//
|
//
|
||||||
@ -1167,6 +1188,10 @@ struct rebind_wrap : boost::container::allocator_traits<
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Functions used to construct nodes. Emulates variadic construction,
|
||||||
|
// piecewise construction etc.
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace unordered {
|
namespace unordered {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -1688,19 +1713,6 @@ construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
|||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace unordered {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template <typename Types> struct table;
|
|
||||||
template <typename NodePointer> struct bucket;
|
|
||||||
struct ptr_bucket;
|
|
||||||
template <typename Types> struct table_impl;
|
|
||||||
template <typename Types> struct grouped_table_impl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The 'iterator_detail' namespace was a misguided attempt at avoiding ADL
|
// The 'iterator_detail' namespace was a misguided attempt at avoiding ADL
|
||||||
// in the detail namespace. It didn't work because the template parameters
|
// in the detail namespace. It didn't work because the template parameters
|
||||||
// were in detail. I'm not changing it at the moment to be safe. I might
|
// were in detail. I'm not changing it at the moment to be safe. I might
|
||||||
@ -1714,15 +1726,6 @@ namespace iterator_detail {
|
|||||||
//
|
//
|
||||||
// all no throw
|
// all no throw
|
||||||
|
|
||||||
template <typename Node> struct iterator;
|
|
||||||
template <typename Node> struct c_iterator;
|
|
||||||
template <typename Node, typename Policy> struct l_iterator;
|
|
||||||
template <typename Node, typename Policy> struct cl_iterator;
|
|
||||||
|
|
||||||
// Local Iterators
|
|
||||||
//
|
|
||||||
// all no throw
|
|
||||||
|
|
||||||
template <typename Node, typename Policy>
|
template <typename Node, typename Policy>
|
||||||
struct l_iterator : public std::iterator<std::forward_iterator_tag,
|
struct l_iterator : public std::iterator<std::forward_iterator_tag,
|
||||||
typename Node::value_type, std::ptrdiff_t,
|
typename Node::value_type, std::ptrdiff_t,
|
||||||
@ -2415,19 +2418,12 @@ struct rv_ref
|
|||||||
#define BOOST_UNORDERED_RV_REF(T) \
|
#define BOOST_UNORDERED_RV_REF(T) \
|
||||||
typename boost::unordered::detail::rv_ref<T>::type
|
typename boost::unordered::detail::rv_ref<T>::type
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4127) // conditional expression is constant
|
#pragma warning(disable : 4127) // conditional expression is constant
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace boost {
|
|
||||||
namespace unordered {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// convert double to std::size_t
|
// convert double to std::size_t
|
||||||
|
|
||||||
@ -3122,18 +3118,12 @@ inline void table<Types>::reserve(std::size_t num_elements)
|
|||||||
rehash(static_cast<std::size_t>(
|
rehash(static_cast<std::size_t>(
|
||||||
std::ceil(static_cast<double>(num_elements) / mlf_)));
|
std::ceil(static_cast<double>(num_elements) / mlf_)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
#if defined(BOOST_MSVC)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace boost {
|
////////////////////////////////////////////////////////////////////////
|
||||||
namespace unordered {
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
// key extractors
|
// key extractors
|
||||||
//
|
//
|
||||||
// no throw
|
// no throw
|
||||||
@ -3276,17 +3266,9 @@ template <class Key, class ValueType> struct map_extractor
|
|||||||
BOOST_UNORDERED_KEY_FROM_TUPLE(std::)
|
BOOST_UNORDERED_KEY_FROM_TUPLE(std::)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace boost {
|
////////////////////////////////////////////////////////////////////////
|
||||||
namespace unordered {
|
// Unique nodes
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template <typename A, typename T> struct unique_node;
|
|
||||||
template <typename T> struct ptr_node;
|
|
||||||
template <typename Types> struct table_impl;
|
|
||||||
|
|
||||||
template <typename A, typename T>
|
template <typename A, typename T>
|
||||||
struct unique_node : boost::unordered::detail::value_base<T>
|
struct unique_node : boost::unordered::detail::value_base<T>
|
||||||
@ -3913,17 +3895,9 @@ struct table_impl : boost::unordered::detail::table<Types>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace boost {
|
////////////////////////////////////////////////////////////////////////
|
||||||
namespace unordered {
|
// Grouped nodes
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template <typename A, typename T> struct grouped_node;
|
|
||||||
template <typename T> struct grouped_ptr_node;
|
|
||||||
template <typename Types> struct grouped_table_impl;
|
|
||||||
|
|
||||||
template <typename A, typename T>
|
template <typename A, typename T>
|
||||||
struct grouped_node : boost::unordered::detail::value_base<T>
|
struct grouped_node : boost::unordered::detail::value_base<T>
|
||||||
|
Reference in New Issue
Block a user