mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-15 18:46:09 +00:00
More CScriptSpecialFunction; start rstl::map/red_black_tree
Former-commit-id: 87c0a6041c
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "rstl/rmemory_allocator.hpp"
|
||||
|
||||
namespace rstl {
|
||||
template < typename P >
|
||||
struct select1st {};
|
||||
@@ -10,7 +12,45 @@ struct select1st {};
|
||||
template < typename T >
|
||||
struct less {};
|
||||
|
||||
template < typename T, typename P, int U, typename S = select1st< P >, typename Cmp = less< T > >
|
||||
class red_black_tree {};
|
||||
enum node_color {
|
||||
kNC_Red,
|
||||
kNC_Black,
|
||||
};
|
||||
|
||||
template < typename T, typename P, int U, typename S = select1st< P >, typename Cmp = less< T >,
|
||||
typename Alloc = rmemory_allocator >
|
||||
class red_black_tree {
|
||||
private:
|
||||
struct node {
|
||||
node_color mColor;
|
||||
node* mParent;
|
||||
node* mLeft;
|
||||
node* mRight;
|
||||
P mValue;
|
||||
};
|
||||
struct header {};
|
||||
|
||||
public:
|
||||
struct const_iterator {
|
||||
node* mNode;
|
||||
const header* mHeader;
|
||||
|
||||
const P* operator->() const { return &mNode->mValue; }
|
||||
bool operator==(const const_iterator& other) const {
|
||||
return mNode == other.mNode && mHeader == other.mHeader;
|
||||
}
|
||||
bool operator!=(const const_iterator& other) const {
|
||||
return mNode != other.mNode || mHeader != other.mHeader;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
u8 x0_;
|
||||
u8 x1_;
|
||||
uint x4_;
|
||||
uint x8_;
|
||||
uint xc_;
|
||||
uint x10_;
|
||||
};
|
||||
}; // namespace rstl
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user