1#ifndef LIPH_CONTAINER_SKIP_LIST_H_
2#define LIPH_CONTAINER_SKIP_LIST_H_
12template <
class Key,
class Compare = std::less<Key>,
class Allocator = std::allocator<Key> >
16 skip_list(
const Compare& cmp = Compare(),
const Allocator& alloc = Allocator()) : cmp_(cmp), alloc_(alloc) {}
17 void insert(
const Key& key);
20 int32_t
size()
const {
return head_.size; }
21 int32_t
max_size()
const {
return std::numeric_limits<int32_t>::max(); }
23 iterator
find(
const Key& key);
24 const iterator
find(
const Key& key)
const;
32 const iterator
end()
const;
36 std::list<node_base *> next;
39 struct node_header :
public node_base {
41 node_header() { this->next = {
this}; }
42 node_base *base() {
return this; }
47 const Allocator alloc_;
51template <
class K,
class C,
class A>
54template <
class K,
class C,
class A>
Definition: noncopyable.h:30
Definition: skip_list.h:13
iterator find(const Key &key)
void insert(const Key &key)
Definition: skip_list.h:52
void erase(const Key &key)
bool empty() const
Definition: skip_list.h:19
int32_t max_size() const
Definition: skip_list.h:21
const iterator begin() const
const iterator end() const
skip_list(const Compare &cmp=Compare(), const Allocator &alloc=Allocator())
Definition: skip_list.h:16
int32_t size() const
Definition: skip_list.h:20
const iterator find(const Key &key) const
bool contains(const Key &key) const
Definition: skip_list.h:55
Definition: algorithm.h:10