1/* Copyright 2003-2013 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
16namespace boost{
17
18namespace multi_index{
19
20namespace 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
27template<typename MultiIndexContainer,typename Index>
28struct converter
29{
30 static const Index& index(const MultiIndexContainer& x){return x;}
31 static Index& index(MultiIndexContainer& x){return x;}
32
33 static typename Index::const_iterator const_iterator(
34 const MultiIndexContainer& x,typename MultiIndexContainer::node_type* node)
35 {
36 return x.Index::make_iterator(node);
37 }
38
39 static typename Index::iterator iterator(
40 MultiIndexContainer& x,typename MultiIndexContainer::node_type* node)
41 {
42 return x.Index::make_iterator(node);
43 }
44};
45
46} /* namespace multi_index::detail */
47
48} /* namespace multi_index */
49
50} /* namespace boost */
51
52#endif
53