1 /* Copyright 2003-2020 Joaquin M Lopez Munoz.
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_CONVERTER_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_CONVERTER_HPP
11 
12 #if defined(_MSC_VER)
13 #pragma once
14 #endif
15 
16 namespace boost{
17 
18 namespace multi_index{
19 
20 namespace detail{
21 
22 /* converter offers means to access indices of a given multi_index_container
23  * and for convertibilty between index iterators, so providing a
24  * localized access point for get() and project() functions.
25  */
26 
27 template<typename MultiIndexContainer,typename Index>
28 struct converter
29 {
indexboost::multi_index::detail::converter30   static const Index& index(const MultiIndexContainer& x){return x;}
indexboost::multi_index::detail::converter31   static Index&       index(MultiIndexContainer& x){return x;}
32 
const_iteratorboost::multi_index::detail::converter33   static typename Index::const_iterator const_iterator(
34     const MultiIndexContainer& x,
35     typename MultiIndexContainer::final_node_type* node)
36   {
37     return x.Index::make_iterator(node);
38   }
39 
iteratorboost::multi_index::detail::converter40   static typename Index::iterator iterator(
41     MultiIndexContainer& x,
42     typename MultiIndexContainer::final_node_type* node)
43   {
44     return x.Index::make_iterator(node);
45   }
46 };
47 
48 } /* namespace multi_index::detail */
49 
50 } /* namespace multi_index */
51 
52 } /* namespace boost */
53 
54 #endif
55