Skip to content

Commit eee3388

Browse files
committed
Use auto keyword for iterator and node type.
1 parent c40330a commit eee3388

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tutorial/cst-traversal.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55
using namespace sdsl;
66
using namespace std;
77

8-
typedef cst_sct3<> cst_t;
9-
108
int main(int argc, char* argv[])
119
{
12-
cst_t cst;
10+
cst_sct3<> cst;
1311
construct(cst, argv[1], 1);
1412
uint64_t max_depth = stoull(argv[2]);
1513

1614
// use the DFS iterator to traverse `cst`
17-
for (cst_t::const_iterator it=cst.begin(); it!=cst.end(); ++it) {
15+
for (auto it=cst.begin(); it!=cst.end(); ++it) {
1816
if (it.visit() == 1) { // node visited the first time
19-
cst_t::node_type v = *it; // get the node by dereferencing the iterator
17+
auto v = *it; // get the node by dereferencing the iterator
2018
if (cst.depth(v) <= max_depth) { // if depth node is <= max_depth
2119
// process node, e.g. output it in format d-[lb, rb]
2220
cout<<cst.depth(v)<<"-["<<cst.lb(v)<< ","<<cst.rb(v)<<"]"<<endl;

0 commit comments

Comments
 (0)