Skip to content

Commit e569080

Browse files
committed
stack, queue -> big_stack, big_queue
1 parent 207e8b3 commit e569080

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

cp-algo/graph/dfs.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace cp_algo::graph {
4646
enum { INIT, PROCESS_EDGES, HANDLE_CHILD } state;
4747
};
4848

49-
std::stack<frame> dfs_stack;
49+
big_stack<frame> dfs_stack;
5050

5151
for (auto root: g.nodes()) {
5252
if (context.done) break;

cp-algo/graph/euler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace cp_algo::graph {
5656
edge_index ep;
5757
node_index v;
5858
};
59-
std::stack<stack_frame> stack;
59+
big_stack<stack_frame> stack;
6060
stack.push({-1, v0});
6161

6262
while (!empty(stack)) {

cp-algo/graph/shortest_path.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace cp_algo::graph {
4141
};
4242

4343
struct spfa_context: shortest_path_context {
44-
std::queue<node_index> que;
44+
big_queue<node_index> que;
4545
big_vector<char> flags;
4646
static constexpr char in_queue = 1;
4747
static constexpr char invalidated = 2;

cp-algo/graph/tarjan.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace cp_algo::graph {
1111
template<graph_type graph>
1212
struct tarjan_context: dfs_low_context<graph> {
1313
using base = dfs_low_context<graph>;
14-
std::stack<int> stack;
14+
big_stack<int> stack;
1515
structures::csr<node_index> components;
1616

1717
tarjan_context(graph const& g): base(g) {

cp-algo/util/big_alloc.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include <map>
55
#include <deque>
6+
#include <stack>
7+
#include <queue>
68
#include <vector>
79
#include <string>
810
#include <cstddef>
@@ -73,5 +75,9 @@ namespace cp_algo {
7375
template<typename Key, typename Value, typename Compare = std::less<Key>>
7476
using big_map = std::map<Key, Value, Compare, big_alloc<std::pair<const Key, Value>>>;
7577
using big_string = big_basic_string<char>;
78+
template<typename T>
79+
using big_stack = std::stack<T, big_deque<T>>;
80+
template<typename T>
81+
using big_queue = std::queue<T, big_deque<T>>;
7682
}
7783
#endif // CP_ALGO_UTIL_big_alloc_HPP

0 commit comments

Comments
 (0)