@@ -29,15 +29,15 @@ namespace mtd {
2929 if (first_itr == -1 ) {
3030 first_itr = itr;
3131 } else {
32- rest_itrs.push_back (itr);
32+ rest_itrs.emplace_back (itr);
3333 }
3434 }
3535
3636 auto get_itrs () const -> std::vector<int> {
3737 if (first_itr == -1 ) { return {}; }
3838 std::vector<int > result;
3939 result.reserve (1 + rest_itrs.size ());
40- result.push_back (first_itr);
40+ result.emplace_back (first_itr);
4141 result.insert (result.end (), rest_itrs.begin (), rest_itrs.end ());
4242 return result;
4343 }
@@ -102,8 +102,8 @@ namespace mtd {
102102 template <class Lambda >
103103 auto dfs_edges (const Lambda& lambda) const -> void {
104104 std::stack<int , std::vector<int >> stk;
105- stk.push (ROOT_ODD);
106- stk.push (ROOT_EVEN);
105+ stk.emplace (ROOT_ODD);
106+ stk.emplace (ROOT_EVEN);
107107
108108 while (!stk.empty ()) {
109109 int idx = stk.top ();
@@ -112,7 +112,7 @@ namespace mtd {
112112 const auto & node = m_nodes[idx];
113113 if (node.size > 0 ) { lambda (node.size , node.get_itrs ()); }
114114
115- for (const auto & [_, next_idx] : node.edges ) { stk.push (next_idx); }
115+ for (const auto & [_, next_idx] : node.edges ) { stk.emplace (next_idx); }
116116 }
117117 }
118118
@@ -129,14 +129,14 @@ namespace mtd {
129129 int sl_idx = node.suffix_link ;
130130 if (sl_idx >= 2 && m_nodes[sl_idx].first_itr != -1 ) {
131131 int to = m_nodes[sl_idx].first_itr ;
132- graph[from].push_back (to);
132+ graph[from].emplace_back (to);
133133 ++order_count[to];
134134 }
135135 }
136136
137137 std::queue<int > q;
138138 for (int i = 0 ; i < static_cast <int >(m_s.size ()); ++i) {
139- if (order_count[i] == 0 ) { q.push (i); }
139+ if (order_count[i] == 0 ) { q.emplace (i); }
140140 }
141141
142142 while (!q.empty ()) {
@@ -145,7 +145,7 @@ namespace mtd {
145145 for (int t : graph[f]) {
146146 --order_count[t];
147147 lambda (f, t);
148- if (order_count[t] == 0 ) { q.push (t); }
148+ if (order_count[t] == 0 ) { q.emplace (t); }
149149 }
150150 }
151151 }
0 commit comments