-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiterators_traits.hpp
More file actions
45 lines (39 loc) · 2.07 KB
/
iterators_traits.hpp
File metadata and controls
45 lines (39 loc) · 2.07 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* iterators_traits.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: majermou <majermou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/06 13:26:56 by majermou #+# #+# */
/* Updated: 2021/10/19 17:44:36 by majermou ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ITERATOR_TRAITS_HPP
#define ITERATOR_TRAITS_HPP
#include <iostream>
template<typename Iterator>
struct iterators_traits {
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<typename T>
struct iterators_traits<T*> {
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef std::random_access_iterator_tag iterator_category;
};
template<typename T>
struct iterators_traits<const T*> {
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef const T* pointer;
typedef const T& reference;
typedef std::random_access_iterator_tag iterator_category;
};
#endif // ITERATOR_TRAITS_HPP