]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/iterator/doc/iterator_traits.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / iterator / doc / iterator_traits.rst
CommitLineData
7c673cae
FG
1.. Distributed under the Boost
2.. Software License, Version 1.0. (See accompanying
3.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5+++++++++++++++++
6 Iterator Traits
7+++++++++++++++++
8
9:Author: David Abrahams
10:Contact: dave@boost-consulting.com
11:organization: `Boost Consulting`_
12:date: $Date$
13:copyright: Copyright David Abrahams 2004.
14
15.. _`Boost Consulting`: http://www.boost-consulting.com
16
17:abstract: Header ``<boost/iterator/iterator_traits.hpp>`` provides
18 the ability to access an iterator's associated types using
19 MPL-compatible metafunctions_.
20
21.. _metafunctions: ../../mpl/doc/index.html#metafunctions
22
23Overview
24========
25
26``std::iterator_traits`` provides access to five associated types
27of any iterator: its ``value_type``, ``reference``, ``pointer``,
28``iterator_category``, and ``difference_type``. Unfortunately,
29such a "multi-valued" traits template can be difficult to use in a
30metaprogramming context. ``<boost/iterator/iterator_traits.hpp>``
31provides access to these types using a standard metafunctions_.
32
33Summary
34=======
35
36Header ``<boost/iterator/iterator_traits.hpp>``::
37
38 template <class Iterator>
39 struct iterator_value
40 {
41 typedef typename
42 std::iterator_traits<Iterator>::value_type
43 type;
44 };
45
46 template <class Iterator>
47 struct iterator_reference
48 {
49 typedef typename
50 std::iterator_traits<Iterator>::reference
51 type;
52 };
53
54
55 template <class Iterator>
56 struct iterator_pointer
57 {
58 typedef typename
59 std::iterator_traits<Iterator>::pointer
60 type;
61 };
62
63 template <class Iterator>
64 struct iterator_difference
65 {
66 typedef typename
67 detail::iterator_traits<Iterator>::difference_type
68 type;
69 };
70
71 template <class Iterator>
72 struct iterator_category
73 {
74 typedef typename
75 detail::iterator_traits<Iterator>::iterator_category
76 type;
77 };