草庐IT

ignore_match

全部标签

C++ 模板 : no matching function for call

考虑以下代码templateTexponentiel(Tval,unsignedn){Tresult=one;unsignedi;for(i=0;i(2.0f,3);cout编译器告诉我这个没有匹配函数来调用'exponentiel(float,int)'为什么?奇怪的是exponentiel与int一起使用。 最佳答案 问题出在模板参数列表中的Tone和1.0上。您不能拥有浮点类型的非类型模板参数,也不能将浮点值作为模板参数传递。这是不允许的(据我所知,没有充分的理由不允许这样做)。g++在这里的错误信息是相当无用的。Visual

c++ - 在 Ctrl+Z (EOF) 后恢复从 iostream::cin 读取? ("ignore"不起作用)

为什么当我们只为内部循环提供ctrl+z时,下面程序中的外部循环会终止?#includeintmain(){strings1,s2;while(cin>>s1){cout>s2)cout 最佳答案 按Ctrl+z(在Windows上)关闭标准输入流。一旦关闭,它就会保持关闭状态。内循环完成后,它不会神奇地重新打开。没有理由会这样。 关于c++-在Ctrl+Z(EOF)后恢复从iostream::cin读取?("ignore"不起作用),我们在StackOverflow上找到一个类似的问题

C++ regex_match 不工作

这是我的部分代码boolCSettings::bParseLine(constchar*input){//_asmINT3std::stringline(input);std::size_tposition=std::string::npos,comment;regexcvarPattern("\\.([a-zA-Z_]+)");regexparentPattern("^([a-zA-Z0-9_]+)\\.");regexcvarValue("\\.[a-zA-Z0-9_]+[]*=[]*(\\d+\\.*\\d*)");std::cmatchmatchedParent,matched

c++ - C++ 代码错误 "expected constructor, destructor, or type conversion before ‘(’ token ”和 "no matching function for call to ..."

真正尝试解决错误,仔细检查所有内容。请帮忙。c++新手,请多关照。头文件(.h)#ifndefGUARD_Optimized_quick_sort_h#defineGUARD_Optimized_quick_sort_h#include#include#includeusingnamespacestd;templateclassoptimized_quick_sort{public:optimized_quick_sort(vectorarray){this->array=array;}optimized_quick_sort(listarray){vectortemp(array.b

c++ - "No match for operator="试图在 C++ 中遍历映射

我正在尝试遍历定义如下的map:std::map>ridx_;现在我尝试在以下重载运算符的友元函数中遍历ridx_(它是一个类的私有(private)成员)std::ostream&operator>::iteratorit;//Thefollowingisline34for(it=m.ridx_.begin();it!=m.ridx_.end();it++)osfirst但是g++错误输出:SMatrix.cpp:34:error:nomatchfor'operator='in'it=m->SMatrix::ridx_.std::map::beginwith_Key=unsigned

c++ - "error: no matching function for call to"

我当时在键盘上,我正在尝试使用C++来提高我的技能。我以前从未使用过模板,所以我尝试研究如何使用它们。下面的代码是结果,不幸的是,它不起作用。我确实尝试寻找问题的解决方案,但由于我没有太多使用模板的经验,所以我无法在我的问题和其他问题之间建立任何联系。所以,我决定寻求帮助。templateclassVector2{public:Ax,y;Vector2(Axp,Ayp){this->x=xp;this->y=yp;}};templateclassrayToCast{public:rayToCast(Bangle,Vector2origin,Vector2point1,Vector2po

c++ - 多态性和数据隐藏 : Does a base class override or ignore a derived class' access restrictions?

请看下面的代码list:#includeusingnamespacestd;classBase{public:virtualvoidMessage()=0;};classIntermediate:publicBase{};classFinal:publicIntermediate{voidMessage(){coutMessage();*///Works:Intermediate*finalPtr=&final;//orBase*finalPtr=&final;finalPtr->Message();return0;}注意以下事项:在抽象Base类中,纯虚函数message()是pub

c++ - 为什么 regex_match 抛出 "complexity exception"?

我正在尝试测试(使用boost::regex)文件中的一行是否仅包含由空格分隔的数字条目。我遇到了一个我不明白的异常(见下文)。如果有人能解释为什么抛出它,那就太好了。也许我在这里以定义模式的方式做了一些愚蠢的事情?这是代码://regex_test.cpp#include#include#includeusingnamespacestd;usingnamespaceboost;intmain(){//Mybasicpatterntotestforasinglenumericexpressionconststringnumeric_value_pattern="(?:-|\\+)?[[

c++ - 编译cuda文件报错: "runtime library" mismatch value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in vectorAddition_cuda. o

我尝试在Qt5.2和MSVC2012环境下编译一个cuda文件。在开始我的项目之前,我仔细阅读了问题并回复:CompilingCudacodeinQtCreatoronWindows.但是即使我简单地复制代码并在qt中生成2个文件,仍然会弹出一些错误/main.cpp/vectorAddition.cu错误是:errorLNK2038:mismatchdetectedfor'RuntimeLibrary':value'MDd_DynamicDebug'doesn'tmatchvalue'MTd_StaticDebug'invectorAddition_cuda.o我完全不知道如何修复这

c++ - boost .python : Argument types did not match C++ signature

我在python中调用C++函数时遇到一个奇怪的问题。我公开了一个我想从中调用函数的类:class_>("MyClass",init())//....def("someFunc",&MyClass::someFunc);我得到一个std::shared_ptr来自另一个类的成员变量,该类通过.def_readonly(...)公开当我尝试调用该函数时,出现以下错误:File"pytest.py",line27,intest_funccu.someFunc("string")Boost.Python.ArgumentError:PythonargumenttypesinMyClass.s