-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiterator_traits.hpp
More file actions
51 lines (47 loc) · 1.38 KB
/
iterator_traits.hpp
File metadata and controls
51 lines (47 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef ITERATOR_TRAITS_HPP
#define ITERATOR_TRAITS_HPP
#include <cstddef>
namespace ft {
template <class Category, class T, class Distance = ptrdiff_t,
class Pointer = T *, class Reference = T &>
class iterator
{
public:
typedef T value_type;
typedef Distance difference_type;
typedef Pointer pointer;
typedef Reference reference;
typedef Category iterator_category;
};
template <class iterator>
class iterator_traits
{
public:
typedef typename iterator::difference_type difference_type;
typedef typename iterator::value_type value_type;
typedef typename iterator::pointer pointer;
typedef typename iterator::reference reference;
typedef typename iterator::iterator_category iterator_category;
};
template <class T>
class iterator_traits<T *>
{
public:
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T *pointer;
typedef T &reference;
// typedef typename T::iterator_category iterator_category;
};
template <class T>
class iterator_traits<const T *>
{
public:
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef const T *pointer;
typedef const T &reference;
//typedef T::iterator_category iterator_category;
};
}
#endif