简体   繁体   English

对成员函数set_value的错误调用是ambigious(在使用pugixml库的xcode中)

[英]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 . 您需要将kv的类型更改为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.

相关问题 使用 c++ libgpiod 库,如何将 gpio 行设置为输出并使用 set_value() function 操作单行? - Using c++ libgpiod library, how can I set gpio lines to be outputs and manipulate single lines with set_value() function? 使用 lambda 时对重载 function 的模糊调用 - Ambigious call to overloaded function when using lambda 为什么使用GCC是一个不稳定的函数调用? 模板扣除失败了吗? - Why is it an ambigious function call using GCC? Template deduction failing? 由于删除了功能,请拨打电话? - Call ambigious due to a deleted function? std :: promise set_value和线程安全 - std::promise set_value and thread safety std::promise::set_value 崩溃 - Crash in std::promise::set_value crash 使用函数库,成员函数调用性能变慢 - Using functional Library, slow performance of member function call 为什么从主线程调用时,`std::promise::set_value` 会抛出错误? - Why does `std::promise::set_value` throw an error when invoked from the main thread? 编译错误:boost :: promise <T> :: set_value(const T&)不存在 - Compile error: boost::promise<T>::set_value(const T&) doesn't exist xcode在ncurses.h库中initscr()函数的错误 - error of initscr() function in ncurses.h library using xcode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM