VC++ does not like min and max

This commit is contained in:
Andreas Fabri 2016-03-22 09:25:53 +01:00
parent 9960ea2332
commit 3974c29331
2 changed files with 22 additions and 22 deletions

View File

@ -94,16 +94,16 @@ class Plane_Scan_Tree {
/* Explicit Constructor. */ /* Explicit Constructor. */
explicit Plane_Scan_Tree (const key_compare& comp = key_compare(), explicit Plane_Scan_Tree (const key_compare& comp = key_compare(),
const value_compare& vcomp = value_compare()) const value_compare& vcomp = value_compare())
: less (comp), vless (vcomp), root (NULL), min (NULL), : less (comp), vless (vcomp), root (NULL), m_min (NULL),
max (NULL), _size (0) {} m_max (NULL), _size (0) {}
/* Constructor */ /* Constructor */
template <typename InputIterator> template <typename InputIterator>
Plane_Scan_Tree (InputIterator first, InputIterator last, Plane_Scan_Tree (InputIterator first, InputIterator last,
const key_compare& comp = key_compare(), const key_compare& comp = key_compare(),
const value_compare& vcomp = value_compare()) const value_compare& vcomp = value_compare())
: less (comp), vless (vcomp), root (NULL), min (NULL), : less (comp), vless (vcomp), root (NULL), m_min (NULL),
max (NULL), _size (0) m_max (NULL), _size (0)
{ {
// TODO - Inplement a more efficient algorithm that builds the tree bottom up // TODO - Inplement a more efficient algorithm that builds the tree bottom up
for (;first != last; ++first) for (;first != last; ++first)
@ -116,8 +116,8 @@ class Plane_Scan_Tree {
~Plane_Scan_Tree () { ~Plane_Scan_Tree () {
delete root; delete root;
root = NULL; root = NULL;
min = NULL; m_min = NULL;
max = NULL; m_max = NULL;
_size = 0;; _size = 0;;
} }
@ -128,11 +128,11 @@ class Plane_Scan_Tree {
root = x.root; root = x.root;
x.root = NULL; x.root = NULL;
min = x.min; m_min = x.m_min;
x.min = NULL; x.m_min = NULL;
max = x.max; m_max = x.m_max;
x.max = NULL; x.m_max = NULL;
} }
#endif #endif
*/ */
@ -151,9 +151,9 @@ class Plane_Scan_Tree {
*/ */
void add (const key_type& k, const mapped_type& v) { void add (const key_type& k, const mapped_type& v) {
if (NULL == root) { if (NULL == root) {
min = new _leaf_type (less, vless, this); m_min = new _leaf_type (less, vless, this);
max = min; m_max = m_min;
root = min; root = m_min;
} }
_leaf_type* l = root->leafNode(k); _leaf_type* l = root->leafNode(k);
l->add(k, v); l->add(k, v);
@ -185,12 +185,12 @@ class Plane_Scan_Tree {
/* Begin Iterator */ /* Begin Iterator */
inline iterator begin() { inline iterator begin() {
return iterator (this->min); return iterator (this->m_min);
} }
/* Const Begin Iterator */ /* Const Begin Iterator */
inline const_iterator begin() const { inline const_iterator begin() const {
return const_iterator (this->min); return const_iterator (this->m_min);
} }
/* End Iterator */ /* End Iterator */
@ -209,12 +209,12 @@ class Plane_Scan_Tree {
/* Reverse order Begin Iterator */ /* Reverse order Begin Iterator */
inline reverse_iterator rbegin() { inline reverse_iterator rbegin() {
return reverse_iterator (this->max); return reverse_iterator (this->m_max);
} }
/* Constant Reverse order Begin Iterator */ /* Constant Reverse order Begin Iterator */
const_reverse_iterator rbegin() const { const_reverse_iterator rbegin() const {
return const_reverse_iterator (this->max); return const_reverse_iterator (this->m_max);
} }
/* Reverse order End Iterator */ /* Reverse order End Iterator */
@ -251,11 +251,11 @@ class Plane_Scan_Tree {
/* pointer to root */ /* pointer to root */
_node_type* root; _node_type* root;
/* pointer to min */ /* pointer to m_min */
_leaf_type* min; _leaf_type* m_min;
/* pointer to max */ /* pointer to m_max */
_leaf_type* max; _leaf_type* m_max;
/* size of the tree */ /* size of the tree */
size_t _size; size_t _size;

View File

@ -205,7 +205,7 @@ class _Leaf : public _Node<Key, T, Comp, VComp> {
} }
// Update pointer to max leaf (for reverse iterator) // Update pointer to max leaf (for reverse iterator)
if (this->tree->max == this) this->tree->max = split; if (this->tree->m_max == this) this->tree->m_max = split;
// Create new parent node current node is not root // Create new parent node current node is not root
if (NULL == this->parent) { if (NULL == this->parent) {