-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdstruct.hpp
121 lines (88 loc) · 3.16 KB
/
dstruct.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Use of this source code is governed by Apache-2.0 License
// that can be found in the License file.
//
// Copyright (C) 2023 - present Sunrisepeak
//
// Author: Sunrisepeak (speakshen@163.com)
// ProjectLinks: https://github.com/Sunrisepeak/DStruct
//
#ifndef DSTRUCT_HPP_DSTRUCT
#define DSTRUCT_HPP_DSTRUCT
//#define ENABLE_SMA
// base
#include <core/utils.hpp>
#include <dstruct-static.hpp>
#include <core/ds/Heap.hpp>
#include <core/ds/array/Vector.hpp>
// static
#include <core/ds/array/Array.hpp>
#include <core/ds/linked-list/EmbeddedList.hpp>
// stack
#include <core/ds/stack/Stack.hpp>
#include <core/ds/stack/XValueStack.hpp>
// queue
#include <core/ds/queue/Queue.hpp>
#include <core/ds/queue/DoubleEndedQueue.hpp>
// linked list
#include <core/ds/linked-list/SinglyLinkedList.hpp>
#include <core/ds/linked-list/DoublyLinkedList.hpp>
// String
#include <core/ds/string/BasicString.hpp>
// tree
#include <core/ds/tree/BinarySearchTree.hpp>
#include <core/ds/tree/AVLTree.hpp>
// set
#include <core/ds/set/DisjointSet.hpp>
// map
#include <core/ds/Map.hpp>
#include <core/algorithm.hpp>
// other
#include <memory/StaticMemAllocator.hpp>
namespace dstruct {
// Array
// Vector
// String
using String = BasicString<char, dstruct::Alloc>;
// EmbeddedList
template <typename T, typename Link = DoublyLink_>
using EListNode = EmbeddedListNode_<T, Link>;
// SinglyLinkedList
template <typename T, typename Alloc = dstruct::Alloc>
using SLinkedList = SinglyLinkedList<T, Alloc>;
// DoublyLinkedList
template <typename T, typename Alloc = dstruct::Alloc>
using DLinkedList = DoublyLinkedList<T, Alloc>;
// Queue
template <typename T, typename Alloc = dstruct::Alloc>
using Queue = adapter::Queue<T, DoubleEndedQueue<T, 32, Alloc>>;
template <typename T, size_t ArrSize = 32, typename Alloc = dstruct::Alloc>
using Deque = DoubleEndedQueue<T, ArrSize, Alloc>;
template <typename T, typename CMP = less<T>, typename Alloc = dstruct::Alloc>
using PriorityQueue = Heap<T, CMP, Alloc>;
// Stack
template <typename T, typename Alloc = dstruct::Alloc>
using Stack = adapter::Stack<T, Vector<T, Alloc>>;
//template <typename T, typename Compare, typename StackType = adapter::Stack<T, Vector<T>>>
//class XValueStack;
template <typename T, typename Alloc = dstruct::Alloc>
using MinStack = stack::XValueStack<T, less<T>, adapter::Stack<T, Vector<T, Alloc>> >;
template <typename T, typename Alloc = dstruct::Alloc>
using MaxStack = stack::XValueStack<T, greater<T>, adapter::Stack<T, Vector<T, Alloc>> >;
// Heap
template <typename T, typename Alloc = dstruct::Alloc>
using MinHeap = Heap<T, less<T>, Alloc>;
template <typename T, typename Alloc = dstruct::Alloc>
using MaxHeap = Heap<T, greater<T>, Alloc>;
// Tree
//template <typename T, typename CMP, typename Alloc>
//class BinarySearchTree;
template <typename T>
using EBinaryTreeNode = tree::EmbeddedBinaryTreeNode<T>;
template <typename T, typename Alloc = dstruct::Alloc>
using BSTree = tree::BinarySearchTree<T, less<T>, Alloc>;
// Set
using UFSet = DisjointSet<dstruct::Alloc>;
// Map
//...
};
#endif