diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-02-15 01:19:46 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-02-15 01:21:26 -0300 |
commit | 2185c018f6593e6d64b2beb62202d2291e2e008e (patch) | |
tree | b6f57e0a20ff3d0432e6ac6eb809bc34ca8eefa0 /core/set.h | |
parent | 7ebb224ec1d81ccd62b77f21f01f5267220aee09 (diff) | |
download | redot-engine-2185c018f6593e6d64b2beb62202d2291e2e008e.tar.gz |
begin new serialization framework
also got rid of STL dependency on triangulator
Diffstat (limited to 'core/set.h')
-rw-r--r-- | core/set.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/core/set.h b/core/set.h index d87f635577..95f38d7108 100644 --- a/core/set.h +++ b/core/set.h @@ -249,6 +249,37 @@ private: return (node!=_data._nil)?node:NULL; } + Element *_lower_bound(const T& p_value) const { + + Element *node = _data._root->left; + Element *prev = NULL; + C less; + + while(node!=_data._nil) { + prev=node; + + if (less(p_value,node->value)) + node=node->left; + else if (less(node->value,p_value)) + node=node->right; + else + break; // found + } + + if (node==_data._nil) { + if (prev==NULL) + return NULL; + if (less(prev->value,p_value)) { + + prev=prev->_next; + } + + return prev; + + } else + return node; + } + Element *_insert(const T& p_value, bool& r_exists) { @@ -582,6 +613,12 @@ public: return e; } + + Element *lower_bound(const T& p_value) const { + + return _lower_bound(p_value); + } + inline int size() const { return _data.size_cache; } int calculate_depth() const { |