blob: 4d8fb610ac660d2f488d9617dcadcc6ce8e81a5b [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// Copyright David Abrahams 2003.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
Jeff Thompson2491bd62013-10-15 17:10:24 -07005#ifndef ITERATOR_TRAITS_NDNBOOST_DWA200347_HPP
6# define ITERATOR_TRAITS_NDNBOOST_DWA200347_HPP
Jeff Thompsona28eed82013-08-22 16:21:10 -07007
8# include <ndnboost/detail/iterator.hpp>
9# include <ndnboost/detail/workaround.hpp>
10
11namespace ndnboost {
12
13// Unfortunately, g++ 2.95.x chokes when we define a class template
14// iterator_category which has the same name as its
15// std::iterator_category() function, probably due in part to the
16// "std:: is visible globally" hack it uses. Use
Jeff Thompson3d613fd2013-10-15 15:39:04 -070017// NDNBOOST_ITERATOR_CATEGORY to write code that's portable to older
Jeff Thompsona28eed82013-08-22 16:21:10 -070018// GCCs.
19
Jeff Thompson3d613fd2013-10-15 15:39:04 -070020# if NDNBOOST_WORKAROUND(__GNUC__, <= 2)
21# define NDNBOOST_ITERATOR_CATEGORY iterator_category_
Jeff Thompsona28eed82013-08-22 16:21:10 -070022# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070023# define NDNBOOST_ITERATOR_CATEGORY iterator_category
Jeff Thompsona28eed82013-08-22 16:21:10 -070024# endif
25
26
27template <class Iterator>
28struct iterator_value
29{
30 typedef typename ndnboost::detail::iterator_traits<Iterator>::value_type type;
31};
32
33template <class Iterator>
34struct iterator_reference
35{
36 typedef typename ndnboost::detail::iterator_traits<Iterator>::reference type;
37};
38
39
40template <class Iterator>
41struct iterator_pointer
42{
43 typedef typename ndnboost::detail::iterator_traits<Iterator>::pointer type;
44};
45
46template <class Iterator>
47struct iterator_difference
48{
49 typedef typename ndnboost::detail::iterator_traits<Iterator>::difference_type type;
50};
51
52template <class Iterator>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070053struct NDNBOOST_ITERATOR_CATEGORY
Jeff Thompsona28eed82013-08-22 16:21:10 -070054{
55 typedef typename ndnboost::detail::iterator_traits<Iterator>::iterator_category type;
56};
57
Jeff Thompson3d613fd2013-10-15 15:39:04 -070058# if NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300)
Jeff Thompsona28eed82013-08-22 16:21:10 -070059template <>
60struct iterator_value<int>
61{
62 typedef void type;
63};
64
65template <>
66struct iterator_reference<int>
67{
68 typedef void type;
69};
70
71template <>
72struct iterator_pointer<int>
73{
74 typedef void type;
75};
76
77template <>
78struct iterator_difference<int>
79{
80 typedef void type;
81};
82
83template <>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070084struct NDNBOOST_ITERATOR_CATEGORY<int>
Jeff Thompsona28eed82013-08-22 16:21:10 -070085{
86 typedef void type;
87};
88# endif
89
90} // namespace ndnboost::iterator
91
Jeff Thompson2491bd62013-10-15 17:10:24 -070092#endif // ITERATOR_TRAITS_NDNBOOST_DWA200347_HPP