makefile really improved on header dependencies

This commit is contained in:
hugogogo
2022-06-29 14:10:17 +02:00
parent 26436c8d8a
commit b0b63d6238
27 changed files with 610 additions and 481 deletions

View File

@@ -14,101 +14,87 @@ template <
typename T,
typename Compare,
typename Allocator
> class map_iterator
{
private:
typedef map_iterator Self;
> class map_iterator {
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef pair<const Key, T> value_type;
typedef std::ptrdiff_t difference_type;
typedef value_type* pointer;
typedef value_type& reference;
private:
typedef map_iterator self;
map_iterator() : _node(), _sentinel() {}
map_iterator(node<value_type>* n, node_sentinel<value_type>* sentinel) : _node(n), _sentinel(sentinel) {} // SENTINELL
//map_iterator(node<value_type>* n, node<value_type>* sentinel) : _node(n), _sentinel(sentinel) {}
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef pair<const Key, T> value_type;
typedef std::ptrdiff_t difference_type;
typedef value_type* pointer;
typedef value_type& reference;
reference operator*() const
{ return _node->value; }
pointer operator->() const
{ return &_node->value; }
map_iterator() : _node(), _sentinel() {}
map_iterator(node<value_type>* n, sentinel<value_type>* sentinel)
: _node(n), _sentinel(sentinel) {}
Self& operator++()
reference operator*() const {
return _node->value; }
pointer operator->() const {
return &_node->value; }
self& operator++() {
if (_node == NULL)
_node = _sentinel->child->min();
else if (_node->right)
_node = _node->right->min();
else
{
if (_node == NULL)
_node = _sentinel->child->min(); // SENTINELL
//_node = _sentinel->min();
else if (_node->right)
_node = _node->right->min();
else
node<value_type>* up = _node->up;
while (up != NULL && _node == up->right)
{
node<value_type>* up = _node->up;
while (up != NULL && _node == up->right)
{
_node = up;
up = up->up;
}
_node = up;
up = up->up;
}
return *this;
_node = up;
}
return *this;
}
Self& operator--()
self& operator--() {
if (_node == NULL)
_node = _sentinel->child->max();
else if (_node->left)
_node = _node->left->max();
else
{
if (_node == NULL)
_node = _sentinel->child->max(); // SENTINELL
//_node = _sentinel->max();
else if (_node->left)
_node = _node->left->max();
else
node<value_type>* up = _node->up;
while (up != NULL && _node == up->left)
{
node<value_type>* up = _node->up;
while (up != NULL && _node == up->left)
{
_node = up;
up = up->up;
}
_node = up;
up = up->up;
}
return *this;
}
Self operator++(int)
{
//Self old(*this);
Self old = *this;
++(*this);
return old;
_node = up;
}
return *this;
}
self operator++(int) {
self old = *this;
++(*this);
return old;
}
Self operator--(int)
{
//Self old(*this);
Self old = *this;
--(*this);
return old;
}
self operator--(int) {
self old = *this;
--(*this);
return old;
}
node<value_type>* getNode()
{ return _node; }
const node<value_type>* getNode() const
{ return _node; }
const node_sentinel<value_type>* getSentinel() const // SENTINELL
//const node<value_type>* getSentinel() const
{ return _sentinel; }
node<value_type>* getNode() { return _node; }
const node<value_type>* getNode() const { return _node; }
const sentinel<value_type>* getSentinel() const { return _sentinel; }
// TODO : friend Non-member functions syntaxe pas clair.
friend bool operator==(const Self &lhs, const Self &rhs)
{ return lhs._node == rhs._node; }
friend bool operator!=(const Self &lhs, const Self &rhs)
{ return !(lhs._node == rhs._node); }
friend bool operator==(const self &lhs, const self &rhs) {
return lhs._node == rhs._node; }
friend bool operator!=(const self &lhs, const self &rhs) {
return !(lhs._node == rhs._node); }
private:
node<value_type>* _node;
node_sentinel<value_type>* _sentinel; // SENTINELL
//node<value_type>* _sentinel;
private:
node<value_type>* _node;
sentinel<value_type>* _sentinel;
};
template <
@@ -116,94 +102,90 @@ template <
typename T,
typename Compare,
typename Allocator
> class map_const_iterator
{
private:
typedef map_const_iterator Self;
> class map_const_iterator {
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef pair<const Key, T> value_type;
typedef std::ptrdiff_t difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
private:
typedef map_const_iterator self;
map_const_iterator() : _node(), _sentinel() {}
map_const_iterator(const node<value_type>* node, const node_sentinel<value_type>* sentinel) : _node(node), _sentinel(sentinel) {} // SENTINELL
//map_const_iterator(const node<value_type>* nodee, const node<value_type>* sentinel) : _node(nodee), _sentinel(sentinel) {}
map_const_iterator(const map_iterator<Key, T, Compare, Allocator>& src) : _node(src.getNode()), _sentinel(src.getSentinel()) {}
public:
typedef std::bidirectional_iterator_tag iterator_category;
typedef pair<const Key, T> value_type;
typedef std::ptrdiff_t difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
reference operator*() const
{ return _node->value; }
pointer operator->() const
{ return &_node->value; }
map_const_iterator() : _node(), _sentinel() {}
map_const_iterator (
const node<value_type>* node,
const sentinel<value_type>* sentinel)
: _node(node), _sentinel(sentinel) {}
map_const_iterator (const map_iterator< Key, T, Compare, Allocator >& src)
: _node(src.getNode()), _sentinel(src.getSentinel()) {}
Self& operator++()
reference operator*() const {
return _node->value; }
pointer operator->() const {
return &_node->value; }
self& operator++() {
if (_node == NULL)
_node = _sentinel->child->min();
else if (_node->right)
_node = _node->right->min();
else
{
if (_node == NULL)
_node = _sentinel->child->min(); // SENTINELL
//_node = _sentinel->min();
else if (_node->right)
_node = _node->right->min();
else
node<value_type>* up = _node->up;
while (up != NULL && _node == up->right)
{
node<value_type>* up = _node->up;
while (up != NULL && _node == up->right)
{
_node = up;
up = up->up;
}
_node = up;
up = up->up;
}
return *this;
_node = up;
}
return *this;
}
Self& operator--()
self& operator--() {
if (_node == NULL)
_node = _sentinel->child->max();
else if (_node->left)
_node = _node->left->max();
else
{
if (_node == NULL)
_node = _sentinel->child->max(); // SENTINELL
//_node = _sentinel->max();
else if (_node->left)
_node = _node->left->max();
else
node<value_type>* up = _node->up;
while (up != NULL && _node == up->left)
{
node<value_type>* up = _node->up;
while (up != NULL && _node == up->left)
{
_node = up;
up = up->up;
}
_node = up;
up = up->up;
}
return *this;
}
Self operator++(int)
{
Self old = *this;
++(*this);
return old;
_node = up;
}
return *this;
}
self operator++(int) {
self old = *this;
++(*this);
return old;
}
Self operator--(int)
{
Self old = *this;
--(*this);
return old;
}
self operator--(int) {
self old = *this;
--(*this);
return old;
}
node<value_type>* getNode() const
{ return _node; }
node<value_type>* getNode() const {
return _node; }
friend bool operator==(const Self &lhs, const Self &rhs)
{ return lhs._node == rhs._node; }
friend bool operator!=(const Self &lhs, const Self &rhs)
{ return !(lhs._node == rhs._node); }
friend bool operator==(const self &lhs, const self &rhs) {
return lhs._node == rhs._node; }
friend bool operator!=(const self &lhs, const self &rhs) {
return !(lhs._node == rhs._node); }
private:
const node<value_type>* _node;
const node_sentinel<value_type>* _sentinel; // SENTINELL
//const node<value_type>* _sentinel;
private:
const node<value_type>* _node;
const sentinel<value_type>* _sentinel;
};
} // namespace ft