[857] | 1 | /* Copyright 2003-2004 Joaquín M López Muñoz.
|
---|
| 2 | * Distributed under the Boost Software License, Version 1.0.
|
---|
| 3 | * (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 4 | * http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 5 | *
|
---|
| 6 | * See http://www.boost.org/libs/multi_index for library home page.
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | #ifndef BOOST_MULTI_INDEX_DETAIL_HASH_hashed_index_proxy_HPP
|
---|
| 10 | #define BOOST_MULTI_INDEX_DETAIL_HASH_hashed_index_proxy_HPP
|
---|
| 11 |
|
---|
| 12 | #if defined(_MSC_VER)&&(_MSC_VER>=1200)
|
---|
| 13 | #pragma once
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 | #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
---|
| 17 | #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
---|
| 18 | #include <boost/detail/workaround.hpp>
|
---|
| 19 |
|
---|
| 20 | #if BOOST_WORKAROUND(BOOST_MSVC,<1300)
|
---|
| 21 | #include <algorithm>
|
---|
| 22 | #include <boost/multi_index/detail/hash_index_iterator_fwd.hpp>
|
---|
| 23 | #include <boost/multi_index/detail/safe_mode.hpp>
|
---|
| 24 |
|
---|
| 25 | namespace boost{
|
---|
| 26 |
|
---|
| 27 | namespace multi_index{
|
---|
| 28 |
|
---|
| 29 | namespace detail{
|
---|
| 30 |
|
---|
| 31 | /* Analogous of index_proxy for interoperability with
|
---|
| 32 | * hashed_index_iterator.
|
---|
| 33 | */
|
---|
| 34 |
|
---|
| 35 | template<typename Node,typename BucketArray>
|
---|
| 36 | class hashed_index_proxy:
|
---|
| 37 | public safe_container<hashed_index_proxy<Node,BucketArray> >
|
---|
| 38 | {
|
---|
| 39 | protected:
|
---|
| 40 | hashed_index_proxy(Node* header_,BucketArray& buckets_):
|
---|
| 41 | header(header_),buckets(&buckets_){}
|
---|
| 42 |
|
---|
| 43 | void swap(hashed_index_proxy<Node,BucketArray>& x)
|
---|
| 44 | {
|
---|
| 45 | std::swap(header,x.header);
|
---|
| 46 | std::swap(buckets,x.buckets);
|
---|
| 47 | safe_container<hashed_index_proxy<Node,BucketArray> >::swap(x);
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | public:
|
---|
| 51 | typedef hashed_index_iterator<Node,BucketArray> iterator;
|
---|
| 52 | typedef hashed_index_iterator<Node,BucketArray> const_iterator;
|
---|
| 53 |
|
---|
| 54 | hashed_index_iterator<Node,BucketArray> end()const
|
---|
| 55 | {
|
---|
| 56 | return hashed_index_iterator<Node,BucketArray>(
|
---|
| 57 | Node::end(header),*buckets,const_cast<hashed_index_proxy*>(this));
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | private:
|
---|
| 61 | Node* header;
|
---|
| 62 | BucketArray* buckets;
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | } /* namespace multi_index::detail */
|
---|
| 66 |
|
---|
| 67 | } /* namespace multi_index */
|
---|
| 68 |
|
---|
| 69 | } /* namespace boost */
|
---|
| 70 |
|
---|
| 71 | #endif /* workaround */
|
---|
| 72 |
|
---|
| 73 | #endif /* BOOST_MULTI_INDEX_ENABLE_SAFE_MODE */
|
---|
| 74 |
|
---|
| 75 | #endif
|
---|