2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _RSTL_MAP
|
|
|
|
#define _RSTL_MAP
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-10-03 04:49:11 +00:00
|
|
|
#include "rstl/pair.hpp"
|
2022-08-14 18:38:41 +00:00
|
|
|
#include "rstl/red_black_tree.hpp"
|
2022-08-09 23:03:51 +00:00
|
|
|
#include "rstl/rmemory_allocator.hpp"
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
namespace rstl {
|
2022-08-13 02:48:34 +00:00
|
|
|
template < typename K, typename V, typename Cmp = less< K >, typename Alloc = rmemory_allocator >
|
2022-04-10 00:17:06 +00:00
|
|
|
class map {
|
2022-10-03 04:49:11 +00:00
|
|
|
public:
|
|
|
|
typedef pair< K, V > value_type;
|
|
|
|
|
|
|
|
private:
|
2022-10-25 12:50:23 +00:00
|
|
|
// TODO: some things use a 0, others use a 1
|
|
|
|
typedef red_black_tree< K, value_type, 0, select1st< value_type >, Cmp, Alloc > rep_type;
|
2022-10-03 04:49:11 +00:00
|
|
|
|
|
|
|
public:
|
2022-11-10 02:06:24 +00:00
|
|
|
typedef typename rep_type::iterator iterator;
|
2022-10-03 04:49:11 +00:00
|
|
|
typedef typename rep_type::const_iterator const_iterator;
|
|
|
|
|
2022-11-10 02:06:24 +00:00
|
|
|
iterator insert(const value_type& item) { return inner.insert(item); }
|
2022-10-25 14:29:23 +00:00
|
|
|
|
|
|
|
const_iterator begin() const { return inner.begin(); }
|
|
|
|
const_iterator end() const { return inner.end(); }
|
|
|
|
|
2022-11-10 02:06:24 +00:00
|
|
|
iterator find(const K& key) { return inner.find(key); }
|
2022-10-25 14:29:23 +00:00
|
|
|
const_iterator find(const K& key) const { return inner.find(key); }
|
2022-10-25 12:50:23 +00:00
|
|
|
|
2022-11-10 02:06:24 +00:00
|
|
|
void erase(iterator it) { inner.erase(it); }
|
|
|
|
|
|
|
|
rep_type& get_inner() { return inner; } // hack for CWeaponMgr inlining depth
|
2022-10-03 04:49:11 +00:00
|
|
|
private:
|
|
|
|
rep_type inner;
|
2022-04-10 00:17:06 +00:00
|
|
|
};
|
2022-10-03 04:49:11 +00:00
|
|
|
|
|
|
|
typedef map< char, char > unk_map;
|
|
|
|
CHECK_SIZEOF(unk_map, 0x14)
|
2022-04-10 00:17:06 +00:00
|
|
|
} // namespace rstl
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _RSTL_MAP
|