-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRandomIte_decl.hpp
70 lines (56 loc) · 2.55 KB
/
RandomIte_decl.hpp
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* RandomIte_decl.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mli <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/09 18:56:40 by mli #+# #+# */
/* Updated: 2021/02/08 14:04:25 by mli ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef RANDOMITE_DECL_CLASS_HPP
# define RANDOMITE_DECL_CLASS_HPP
# include "base.hpp"
namespace ft {
template <typename Spe>
class RandIte {
protected:
Spe *_value;
public:
typedef Spe value_type;
typedef ptrdiff_t difference_type;
RandIte(void);
RandIte(Spe *src);
RandIte(const RandIte &src);
virtual ~RandIte(void);
RandIte &operator=(RandIte const &rhs);
bool operator==(const RandIte &rhs) const;
bool operator!=(const RandIte &rhs) const;
bool operator<(const RandIte &rhs) const;
bool operator<=(const RandIte &rhs) const;
bool operator>(const RandIte &rhs) const;
bool operator>=(const RandIte &rhs) const;
RandIte<Spe> &operator++(void);
RandIte<Spe> operator++(int);
RandIte<Spe> &operator--(void);
RandIte<Spe> operator--(int);
difference_type operator-(const RandIte &rhs) const;
RandIte<Spe> operator+(difference_type n) const;
RandIte<Spe> operator-(difference_type n) const;
friend RandIte<Spe> operator+(difference_type n, const RandIte &rhs)
{ return rhs.operator+(n); };
/* Cannnot do reversed subtraction
friend RandIte<Spe> operator-(difference_type n, const RandIte &rhs)
{ return (RandIte(rhs._value - n)); };
*/
/* Declared in sub-classes:
reference operator*(void) const;
pointer operator->(void) const;
reference operator+=(difference_type n);
reference operator-=(difference_type n);
reference operator[](difference_type n);
*/
}; // ************************************************* class RandIte end //
} // ******************************************************* ft namespace end //
#endif // ************************************** RANDOMITE_DECL_CLASS_HPP end //