[英]error call to member function set_value is ambigious (in xcode using pugixml library)
i am using pugixml in visual c++ express 2010. this code works. 我在visual c ++ express 2010中使用pugixml。此代码有效。 however when i use it in xcode. 但是当我在xcode中使用它时。 it gives me an error that 'call to member function ''set_value'' is ambigious'. 它给了我一个错误,'调用成员函数''set_value''是暧昧的'。 can any body help in solving it or why it is giving me error in xcode. 可以任何身体帮助解决它或为什么它给我xcode错误。
for (size_t k = 0; k < num; ++k) {
for (size_t v = 0; v < height; ++v) {
if(width==2){
pugi::xml_node weightNode = weightsNode.append_child("Test_Output");
weightNode.append_attribute("No").set_value(k);
weightNode.append_attribute("index1").set_value(v);
weightNode.append_attribute("index2").set_value(v); //as 1x2 case first value position is (0x0)
weightNode.append_attribute("value").set_value(networks[k][6][0].at<double>(v,v));
weightNode.append_attribute("index1").set_value(v);
weightNode.append_attribute("index2").set_value(v+1);
weightNode.append_attribute("value").set_value(networks[k][6][0].at<double>(v,v+1));
}else{
for (size_t u = 0; u < width; ++u) {
pugi::xml_node weightNode = weightsNode.append_child("Output");
weightNode.append_attribute("No").set_value(k);
weightNode.append_attribute("index1").set_value(v);
weightNode.append_attribute("index2").set_value(u);
weightNode.append_attribute("value").set_value(networks[k][6][0].at<double>(v,u));
weightNode.append_attribute("index1").set_value(v);
weightNode.append_attribute("index2").set_value(u);
weightNode.append_attribute("value").set_value(networks[k][6][0].at<double>(v,u));
}
}
}
}
can any body pinpoint why it is giving error in xcode. 任何人都可以找出它在xcode中给出错误的原因。 however it works properly in visual c++. 但它在visual c ++中正常工作。
thanks 谢谢
According to the documentation , there are overloads of set_value
for several types: 根据文档 ,有几种类型的set_value
重载:
bool set_value(const char_t* rhs);
bool set_value(int rhs);
bool set_value(unsigned int rhs);
bool set_value(double rhs);
bool set_value(bool rhs);
but not for size_t
, unless it happens to be an alias for unsigned int
. 但不是size_t
,除非它碰巧是unsigned int
的别名。
You'll need to either change the type of k
and v
to unsigned int
, or cast when calling set_value
. 您需要将k
和v
的类型更改为unsigned int
,或者在调用set_value
时进行set_value
。 If you need support for very large values which aren't representable by unsigned int
, then you'll need a better library. 如果您需要支持unsigned int
无法表示的非常大的值,那么您将需要一个更好的库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.