-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiterator_experiment.hpp
More file actions
50 lines (35 loc) · 1.04 KB
/
iterator_experiment.hpp
File metadata and controls
50 lines (35 loc) · 1.04 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
#ifndef ITERATOR_EXPERIMENT_H
# define ITERATOR_EXPERIMENT_H
# include "type_traits/type_traits.hpp"
template<bool IsConst>
class MyIterator {
friend class MyIterator<true>;
int _i;
public:
MyIterator(void);
MyIterator(MyIterator<IsConst> const & src);
template<bool WasConst>
MyIterator(MyIterator<WasConst> const & src,
typename ft::enable_if<IsConst || !WasConst>::type * = 0);
~MyIterator(void);
MyIterator<IsConst> & operator=(MyIterator<false> const & rhs);
bool operator==(MyIterator const& rhs);
};
template<bool IsConst>
MyIterator<IsConst>::MyIterator(void) : _i(0)
{}
template<bool IsConst>
MyIterator<IsConst>::MyIterator(MyIterator<IsConst> const & src) : _i(src._i)
{}
template<bool IsConst>
template<bool WasConst>
MyIterator<IsConst>::MyIterator(MyIterator<WasConst> const & src,
typename ft::enable_if<IsConst || !WasConst>::type *) : _i(src._i)
{}
template<bool IsConst>
MyIterator<IsConst> & MyIterator<IsConst>::operator=(MyIterator<false> const & rhs)
{
this->_i = rhs._i;
return (*this);
}
#endif