stack almost good

This commit is contained in:
hugogogo
2022-06-24 02:23:53 +02:00
parent 58d417742b
commit 6617d6cdf5
23 changed files with 3137 additions and 1081 deletions

View File

@@ -27,8 +27,8 @@ template <
typedef value_type& reference;
map_iterator() : _node(), _sentinel() {}
map_iterator(node<value_type>* n, node_sentinel<value_type>* sentinel) : _node(n), _sentinel(sentinel) {}
//map_iterator(const map_iterator& src) : _node(src._node), _sentinel(src._sentinel) {} //implicit
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) {}
reference operator*() const
{ return _node->value; }
@@ -38,7 +38,8 @@ template <
Self& operator++()
{
if (_node == NULL)
_node = _sentinel->child->min();
_node = _sentinel->child->min(); // SENTINELL
//_node = _sentinel->min();
else if (_node->right)
_node = _node->right->min();
else
@@ -57,7 +58,8 @@ template <
Self& operator--()
{
if (_node == NULL)
_node = _sentinel->child->max();
_node = _sentinel->child->max(); // SENTINELL
//_node = _sentinel->max();
else if (_node->left)
_node = _node->left->max();
else
@@ -93,7 +95,8 @@ template <
{ return _node; }
const node<value_type>* getNode() const
{ return _node; }
const node_sentinel<value_type>* getSentinel() const
const node_sentinel<value_type>* getSentinel() const // SENTINELL
//const node<value_type>* getSentinel() const
{ return _sentinel; }
// TODO : friend Non-member functions syntaxe pas clair.
@@ -104,7 +107,8 @@ template <
private:
node<value_type>* _node;
node_sentinel<value_type>* _sentinel;
node_sentinel<value_type>* _sentinel; // SENTINELL
//node<value_type>* _sentinel;
};
template <
@@ -125,8 +129,8 @@ template <
typedef const value_type& reference;
map_const_iterator() : _node(), _sentinel() {}
map_const_iterator(const node<value_type>* node, const node_sentinel<value_type>* sentinel) : _node(node), _sentinel(sentinel) {}
//map_const_iterator(const map_const_iterator& src) : _node(src._node), _sentinel(src._sentinel) {} //implicit
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()) {}
reference operator*() const
@@ -137,7 +141,8 @@ template <
Self& operator++()
{
if (_node == NULL)
_node = _sentinel->child->min();
_node = _sentinel->child->min(); // SENTINELL
//_node = _sentinel->min();
else if (_node->right)
_node = _node->right->min();
else
@@ -156,7 +161,8 @@ template <
Self& operator--()
{
if (_node == NULL)
_node = _sentinel->child->max();
_node = _sentinel->child->max(); // SENTINELL
//_node = _sentinel->max();
else if (_node->left)
_node = _node->left->max();
else
@@ -174,7 +180,6 @@ template <
Self operator++(int)
{
//Self old(*this);
Self old = *this;
++(*this);
return old;
@@ -182,7 +187,6 @@ template <
Self operator--(int)
{
//Self old(*this);
Self old = *this;
--(*this);
return old;
@@ -198,7 +202,8 @@ template <
private:
const node<value_type>* _node;
const node_sentinel<value_type>* _sentinel;
const node_sentinel<value_type>* _sentinel; // SENTINELL
//const node<value_type>* _sentinel;
};
} // namespace ft