Skip to content

Commit 18d5e3a

Browse files
committed
[FIX] ambiguous call
Clash with std::format
1 parent efbeef7 commit 18d5e3a

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tutorial/csx-printf.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <sdsl/cst_sct3.hpp>
77

88
using namespace sdsl;
9-
using namespace std;
109

1110
std::string format("%3I%3S %3s %3P %3p %3L %3B %T");
1211
std::string header(" i SA ISA PSI LF LCP BWT TEXT");
@@ -19,19 +18,19 @@ typedef cst_sct3<csa_int_t> cst_int_t;
1918

2019
void print_usage(char const * command)
2120
{
22-
cout << "\
21+
std::cout << "\
2322
A pretty printer for suffix array/tree members.\n\
2423
Transforms each input line into a CST and outputs\n\
2524
formatted suffix array/tree members.\n\
2625
Usage: " << command
27-
<< " X \"[FORMAT]\" \"[HEADER]\" \"[SENTINEL]\"\n\
26+
<< " X \"[FORMAT]\" \"[HEADER]\" \"[SENTINEL]\"\n\
2827
X : Input is interpreted dependent on X.\n\
2928
X=1: byte sequence.\n\
3029
X=d: sequence of decimal numbers.\n\
3130
FORMAT : Format string. Default=`"
32-
<< format << "`.\n\
31+
<< format << "`.\n\
3332
HEADER : Header string. Default=`"
34-
<< header << "`.\n\
33+
<< header << "`.\n\
3534
SENTINEL: Sentinel character. \n\
3635
\n\
3736
Each line of the output will be formatted according to the format string.\
@@ -68,24 +67,24 @@ int main(int argc, char * argv[])
6867
{
6968
header = argv[3];
7069
}
71-
while (cin.getline(line, BUF_SIZE))
70+
while (std::cin.getline(line, BUF_SIZE))
7271
{
73-
cout << header << endl;
72+
std::cout << header << std::endl;
7473
if ('1' == argv[1][0])
7574
{
7675
cst_byte_t cst;
7776
construct_im(cst, (char const *)line, 1);
78-
stringstream ss;
77+
std::stringstream ss;
7978
csXprintf(ss, format, cst, ((argc > 4) ? argv[4][0] : '$'));
8079
std::string line(ss.str());
81-
cout << std::regex_replace(line, std::regex(R"(\$)"), "\\$") << endl;
80+
std::cout << std::regex_replace(line, std::regex(R"(\$)"), "\\$") << std::endl;
8281
}
8382
else if ('d' == argv[1][0])
8483
{
8584
cst_int_t cst;
8685
construct_im(cst, (char const *)line, 'd');
87-
csXprintf(cout, format, cst, ((argc > 4) ? argv[4][0] : '0'));
86+
csXprintf(std::cout, format, cst, ((argc > 4) ? argv[4][0] : '0'));
8887
}
89-
cout << endl;
88+
std::cout << std::endl;
9089
}
9190
}

0 commit comments

Comments
 (0)