草庐IT

called_notebook

全部标签

c++ - 错误 : no matching member function for call to 'push_back'

为什么我在最后两行收到错误?目标是在集合中找到对象,并修改其内容。usingnamespacestd;structmystruct{intid;vectory;mystruct(constintid):id(id){}booloperatorsx;mystructx(1);x.y.push_back(1);x.y.push_back(2);sx.insert(x);//set::iteratori=sx.find(1);constmystruct*x1=&(*i);constmystructx2=*x1;couty)y)y.push_back(4);}好像迭代器返回的是常量对象,不让我

c++ - 复制初始化: why move or copy constructor was not called even if copy-elision is turned off?

我的问题不同,因为我可能“知道”复制省略。我正在学习复制初始化。但是,以下代码让我感到困惑,因为我已经使用-fno-elide-contructors-O0选项关闭了复制省略。#includeusingnamespacestd;classtest{public:test(inta_,intb_):a{a_},b{b_}{}test(consttest&other){cout我首先使用命令构建:g++-std=c++11-fno-elide-constructors-O0main.cpp-omain得到如下结果:**showelideconstructors**moveconstruct

c++ - 错误 : no matching function for call to . .. 在返回语句

我在openSUSELeap15上的Qt5.9.4上使用GCC7。我有以下类(class):classManSuppProps:publicQObject{Q_OBJECTpublic:explicitManSuppProps(QStringparentName);explicitManSuppProps(){}explicitManSuppProps(constManSuppProps&manSuppProps);explicitManSuppProps(ManSuppProps&manSuppProps);~ManSuppProps();private:QVector3Dm_sup

c++ - 虚假 "missing sentinel in function call"

如果编译为CandC++源代码,这个简单的代码片段会使用g++4.7.0生成“函数调用中缺少标记”警告。我相信这是编译器的错误,因为最终的NULL值(value)就在那里。#includeintmain(){execlp("mkdir","mkdir","-p","test",NULL);return0;}我说得对吗? 最佳答案 不,你错了。在C++中NULL类似于0或0L并且在C中可能是相同的。如果该常量的类型小于指针那么它是不安全的将其传递给可变参数函数,因为高位将被垃圾填满。在Linux上,execlp(1)手册页说:Thel

c++ - Qt 信号槽 : Signal is sent but Slot is not called

我在C++的VisualStudio2013中使用Qt。我正在尝试将信号连接到插槽。问题是信号已发送,但槽函数从未被调用,我不知道发生了什么。这段代码之前可以工作,但是在我将代码从32位的VisualStudio2012迁移到64位的VisualStudio2013并进行一些更改后,它不再工作了。它打印调试语句:发送前、发送图像和连接,但不打印接收到的图像。有人可以帮忙吗?Streamer.hsignals://SignaltooutputframetobedisplayedvoidprocessedImageStream(constvector&imgs,constQImage&im

c++ - 海湾合作委员会 "no matching function for call.."错误

我正在开发一个跨平台代码库,其中初始工作是使用MSVC2010编译器完成的。后来我在Linux上使用GCC(4.7)编译它。在许多情况下,我收到:“没有匹配的调用函数..”GCC中的错误。我注意到它主要在方法参数是非常量引用时提示。例如:voidMyClass::DoSomeWork(ObjectSP&sprt,conststd::stringsomeName,conststd::stringanotherName,conststd::stringpath,intindex){sprt->GetProp()->Update(path,false);}一旦我将方法更改为:voidMyCl

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

如何在 Ubuntu 16.04 上设置 Jupyter Notebook 来运行 IPython

简介IPython是Python的交互式命令行界面。JupyterNotebook提供了一个交互式的Web界面,可以运行多种语言,包括IPython。本文将指导您设置一个服务器来运行JupyterNotebook,并教您如何连接和使用笔记本。Jupyter笔记本(或简称笔记本)是由JupyterNotebook应用程序生成的文档,其中包含计算机代码(例如Python)和丰富的文本元素(段落、方程式、图表、链接等),有助于展示可重现的研究。通过本指南,您将能够在远程服务器上运行Python2.7代码,使用IPython和JupyterNotebook。出于本教程的目的,使用Python2(2.7

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++ - 这是正确的 : virtual method of Derived called before constructing Base object?

我知道在Base类的构造函数中-当调用虚拟方法时-调用Base方法,而不是派生-参见Callingvirtualfunctionsinsideconstructors.我的问题与这个主题有关。我只是想知道如果我在Derived类构造函数中调用虚拟方法会发生什么-但在构造Base部分之前。我的意思是调用虚方法来评估基类构造函数参数,请参见代码:classBase{public:Base(constchar*name):name(name){cout编译器g++(4.3.x-4.5x版本)输出为:Derived::getName()Base():DerivedDerived():Deriv