ddd install strclass.h error: friend declaration of ‘string common_prefix

ddd install strclass.h error: friend declaration of ‘string common_prefix

ddd version as following:

ddd-3.3.12.tar.gz

 

when do make ,compile error similar following 

ddd install strclass.h error: friend declaration of ‘string common_prefix

 

diff --git i/ddd/strclass.h w/ddd/strclass.h
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)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值