i am using pugixml in visual c++ express 2010. this code works. however when i use it in xcode. it gives me an error that 'call to member function ''set_value'' is ambigious'. can any body help in solving it or why it is giving me error in 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. however it works properly in visual c++.
thanks
According to the documentation, there are overloads of set_value
for several types:
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
.
You'll need to either change the type of k
and v
to unsigned int
, or cast when calling set_value
. If you need support for very large values which aren't representable by unsigned int
, then you'll need a better library.