131 class ModerateSizeArrayCheck : public XmlRpcServerMethod
132 {
133 public:
134 ModerateSizeArrayCheck(XmlRpcServer* s) :
XmlRpcServerMethod("validator1.moderateSizeArrayCheck", s) {}
135
136 void execute(XmlRpcValue& params, XmlRpcValue& result)
137 {
138 std::cerr << "ModerateSizeArrayCheck\n";
139 std::string s = params[0][0];
140> s += params[0][params[0].size()-1];
141 result = s;
142 }
143 } moderateSizeArrayCheck(&s);
When compiling with gcc 3.3.1 on Solaris 8, I get:
Validator.cpp:140: error: ambiguous overload for 'operator+=' ...
Problem is, since there's no exact match, there are three things
an XmlRpcValue can be cast to that can be appended to a string,
and three flavors of += worth considering:
XmlRpc++ 0.7 test/Validator.cpp:
131 class ModerateSizeArrayCheck : public XmlRpcServerMethod
132 {
133 public:
134 ModerateSizeArrayCheck(XmlRpcServer* s) :
XmlRpcServerMethod("validator1.moderateSizeArrayCheck", s) {}
135
136 void execute(XmlRpcValue& params, XmlRpcValue& result)
137 {
138 std::cerr << "ModerateSizeArrayCheck\n";
139 std::string s = params[0][0];
140> s += params[0][params[0].size()-1];
141 result = s;
142 }
143 } moderateSizeArrayCheck(&s);
When compiling with gcc 3.3.1 on Solaris 8, I get:
Validator.cpp:140: error: ambiguous overload for 'operator+=' ...
Problem is, since there's no exact match, there are three things
an XmlRpcValue can be cast to that can be appended to a string,
and three flavors of += worth considering:
string& string::operator+=(const string&)
string& string::operator+=(const char*)
string& string::operator+=(char)
Looks to me as if the compiler's right and the code is wrong. I
don't know why gcc 3.1 and 3.2.2 didn't complain.
Am I missing something? --PSRC
Add an extra variable to fix...
std::cerr << "ModerateSizeArrayCheck\n";
std::string s = params[0][0];
std::string blah = params[0][params[0].size()-1];
s += blah;
result = s;