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
|
--- ddd-3.3.12-orig/ddd/strclass.C
+++ ddd-3.3.12/ddd/strclass.C
index 7ef16fa..faea640 100644
--- i/ddd/strclass.h
+++ w/ddd/strclass.h
@@ -810,10 +810,10 @@ public:
friend int split(const string& x, string *res, int maxn,
const regex& sep);
- friend string common_prefix(const string& x, const string& y,
- int startpos = 0);
- friend string common_suffix(const string& x, const string& y,
- int startpos = -1);
+ inline string common_prefix(const string& x, const string& y);
+ friend string common_prefix(const string& x, const string& y, int startpos);
+ inline string common_suffix(const string& x, const string& y);
+ friend string common_suffix(const string& x, const string& y, int startpos);
friend string replicate(char c, int n);
friend string replicate(const string& y, int n);
friend string join(const string *src, int n, const string& sep);
@@ -863,9 +863,10 @@ public:
friend inline std::ostream& operator<<(std::ostream& s, const subString& x);
friend std::istream& operator>>(std::istream& s, string& x);
- friend int readline(std::istream& s, string& x,
- char terminator = '\n',
- int discard_terminator = 1);
+ inline int readline(std::istream& s, string& x);
+ inline int readline(std::istream& s, string& x, char terminator);
+ friend int readline(std::istream& s, string& x, char terminator,
+ int discard_terminator);
// Status
unsigned int length() const;
@@ -1456,6 +1457,16 @@ inline string operator + (char x, const subString& y)
string r; cat(x, y, r); return r;
}
+inline string common_prefix(const string& x, const string& y)
+{
+ return common_prefix(x, y, 0);
+}
+
+inline string common_suffix(const string& x, const string& y)
+{
+ return common_suffix(x, y, -1);
+}
+
inline string reverse(const string& x)
{
string r; r.rep = string_Sreverse(x.rep, r.rep); return r;
@@ -1476,6 +1487,16 @@ inline string capitalize(const string& x)
string r; r.rep = string_Scapitalize(x.rep, r.rep); return r;
}
+inline int readline(std::istream& s, string& x)
+{
+ return readline(s, x, '\n', 1);
+}
+
+inline int readline(std::istream& s, string& x, char terminator)
+{
+ return readline(s, x, terminator, 1);
+}
+
// prepend
inline string& string::prepend(const string& y)
|