1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2014-2014.
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//
8// See http://www.boost.org/libs/move for documentation.
9//
10//////////////////////////////////////////////////////////////////////////////
11
12//! \file
13
14#ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP
15#define BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP
16
17#ifndef BOOST_CONFIG_HPP
18# include <boost/config.hpp>
19#endif
20#
21#if defined(BOOST_HAS_PRAGMA_ONCE)
22# pragma once
23#endif
24
25#include <cstddef>
26
27#if defined(__clang__) && defined(_LIBCPP_VERSION)
28 #define BOOST_MOVE_CLANG_INLINE_STD_NS
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wc++11-extensions"
31 #define BOOST_MOVE_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD
32 #define BOOST_MOVE_STD_NS_END _LIBCPP_END_NAMESPACE_STD
33#else
34 #define BOOST_MOVE_STD_NS_BEG namespace std{
35 #define BOOST_MOVE_STD_NS_END }
36#endif
37
38BOOST_MOVE_STD_NS_BEG
39
40struct input_iterator_tag;
41struct forward_iterator_tag;
42struct bidirectional_iterator_tag;
43struct random_access_iterator_tag;
44struct output_iterator_tag;
45
46BOOST_MOVE_STD_NS_END
47
48#ifdef BOOST_MOVE_CLANG_INLINE_STD_NS
49 #pragma GCC diagnostic pop
50 #undef BOOST_MOVE_CLANG_INLINE_STD_NS
51#endif //BOOST_MOVE_CLANG_INLINE_STD_NS
52
53namespace boost{ namespace movelib{
54
55template<class Iterator>
56struct iterator_traits
57{
58 typedef typename Iterator::difference_type difference_type;
59 typedef typename Iterator::value_type value_type;
60 typedef typename Iterator::pointer pointer;
61 typedef typename Iterator::reference reference;
62 typedef typename Iterator::iterator_category iterator_category;
63};
64
65template<class T>
66struct iterator_traits<T*>
67{
68 typedef std::ptrdiff_t difference_type;
69 typedef T value_type;
70 typedef T* pointer;
71 typedef T& reference;
72 typedef std::random_access_iterator_tag iterator_category;
73};
74
75template<class T>
76struct iterator_traits<const T*>
77{
78 typedef std::ptrdiff_t difference_type;
79 typedef T value_type;
80 typedef const T* pointer;
81 typedef const T& reference;
82 typedef std::random_access_iterator_tag iterator_category;
83};
84
85}} //namespace boost { namespace movelib{
86
87#endif //#ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP
88