summaryrefslogtreecommitdiff
path: root/boost/multi_index/hashed_index.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/multi_index/hashed_index.hpp')
-rw-r--r--boost/multi_index/hashed_index.hpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/boost/multi_index/hashed_index.hpp b/boost/multi_index/hashed_index.hpp
index d14779a842..7b14222374 100644
--- a/boost/multi_index/hashed_index.hpp
+++ b/boost/multi_index/hashed_index.hpp
@@ -1,4 +1,4 @@
-/* Copyright 2003-2017 Joaquin M Lopez Munoz.
+/* Copyright 2003-2018 Joaquin M Lopez Munoz.
* 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)
@@ -16,6 +16,7 @@
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm>
#include <boost/call_traits.hpp>
+#include <boost/core/addressof.hpp>
#include <boost/detail/allocator_utilities.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/detail/workaround.hpp>
@@ -44,6 +45,7 @@
#include <functional>
#include <iterator>
#include <utility>
+#include <memory>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list>
@@ -126,10 +128,18 @@ public:
typedef tuple<std::size_t,
key_from_value,hasher,key_equal> ctor_args;
typedef typename super::final_allocator_type allocator_type;
+#ifdef BOOST_NO_CXX11_ALLOCATOR
typedef typename allocator_type::pointer pointer;
typedef typename allocator_type::const_pointer const_pointer;
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference;
+#else
+ typedef std::allocator_traits<allocator_type> allocator_traits;
+ typedef typename allocator_traits::pointer pointer;
+ typedef typename allocator_traits::const_pointer const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+#endif
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
@@ -238,12 +248,12 @@ public:
iterator iterator_to(const value_type& x)
{
- return make_iterator(node_from_value<node_type>(&x));
+ return make_iterator(node_from_value<node_type>(boost::addressof(x)));
}
const_iterator iterator_to(const value_type& x)const
{
- return make_iterator(node_from_value<node_type>(&x));
+ return make_iterator(node_from_value<node_type>(boost::addressof(x)));
}
/* modifiers */
@@ -563,12 +573,14 @@ public:
local_iterator local_iterator_to(const value_type& x)
{
- return make_local_iterator(node_from_value<node_type>(&x));
+ return make_local_iterator(
+ node_from_value<node_type>(boost::addressof(x)));
}
const_local_iterator local_iterator_to(const value_type& x)const
{
- return make_local_iterator(node_from_value<node_type>(&x));
+ return make_local_iterator(
+ node_from_value<node_type>(boost::addressof(x)));
}
/* hash policy */