草庐IT

is_deleted

全部标签

c++ - 在 switch 语句中使用类类型 : is it better than using typeid operator?

我在下面看到了有关C++标准$6.4.2中switch语句的内容。Switch语句可以带一个条件。Theconditionshallbeofintegraltype,enumerationtype,orofaclasstypeforwhichasingleconversionfunctiontointegralorenumerationtypeexists(12.3).Iftheconditionisofclasstype,theconditionisconvertedbycallingthatconversionfunction,andtheresultoftheconversion

c++ - "integer constant is too large for ‘long’ 求最大质因数时键入"

我正在解决Euler项目3:Description:Theprimefactorsof13195are5,7,13and29.Whatisthelargestprimefactorofthenumber600851475143?这是我生成答案的代码。但是我需要一个整数类型来保存600851475143。当我在Mac上的GCC上编译它时,我得到:integerconstantistoolargefor‘long’type".我预计longlong可以轻松持有这个数字。我也试过让它未签名。为什么我的代码不能保存这么小的数字?我该怎么做才能让它发挥作用?#include#includeusi

c++ - 通过引用与通过值传递指向函数的指针,以及在指针链上使用 delete

假设我这样做:voidfunc(int*&refptr){*refptr=7;}int*ptr=newint;func(ptr);现在,如果我不使用引用运算符,在func中不会完成完全相同的事情吗?无论哪种方式,您都在堆中访问相同的int值,那么一种方式比另一种方式更可取吗?是否应该仅在您尝试更改指针...指向的位置时才使用引用运算符?我不清楚这一点,我的教授也没有帮助。:(我的另一个问题与删除运算符有关。假设我有:int**ptr=newint*;ptr*=newint;如果我想释放堆中分配的所有内存,我可以只对ptr使用delete一次,还是必须先删除ptr*然后再删除ptr?非常

c++ - dll 的 new 和 delete 运算符重载

如何为dll重载new和delete运算符。我已经将重载运算符作为dll的一部分编写,但是与此dll链接的客户端不使用overloadednewanddelete 最佳答案 这是C++标准在第17.6.4.6/3节中对此的说明:Theprogram'sdefinitions(ofthenew/deleteoperators)areusedinsteadofthedefaultversionssuppliedbytheimplementation.Suchreplacementoccurspriortoprogramstartup.T

c++ - std::runtime_error 子类的 "call to deleted constructor of"编译器错误

我从std::runtime_error派生了一个异常类,以便添加对异常流的支持。我收到一个奇怪的编译器错误输出,我不确定如何解决?clang++-std=c++11-stdlib=libc++-g-Wall-I../-I/usr/local/includeMain.cpp-cMain.cpp:43:19:error:calltodeletedconstructorof'EarthException'throwEarthException(__FILE__,__LINE__)^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~../EarthExce

解决:OpenCV: FFMPEG: tag 0x44495658/‘XVID‘ is not supported with codec id 12 and format ‘mp4 / MP4

解决:OpenCV:FFMPEG:tag0x44495658/‘XVID’isnotsupportedwithcodecid12andformat'mp4/MP4文章目录解决:OpenCV:FFMPEG:tag0x44495658/'XVID'isnotsupportedwithcodecid12andformat'mp4/MP4背景报错问题报错翻译代码如下fourcc报错原因解决方法今天的分享就到此结束了背景在使用之前的代码利用python的opencv包把图片合并为视频(mp4格式)的时候,报错:OpenCV:FFMPEG:tag0x44495658/‘XVID’isnotsupporte

c++ - c++ 中的 malloc/free 和 new/delete 兼容性?

malloc/free和new/delete有一个很好的比较here,以及malloc()和free()如何工作的很好的解释here.显然,我们不会混合使用它们-将free与new一起使用或将delete与malloc一起使用。我们可以看到很多开源项目,有很多贡献者,使用这两种机制,同时遵守上述“禁止混合”规则。通常,您在一个文件中只有一种方式(一位作者,一种偏好)。我已经fork了这样一个项目,我正在使用new/delete添加一些功能。但是我遇到了一些奇怪的内存损坏。当然,我可能对他们负责,但是.....这让我问了一些“幼稚”的问题:我可以在同一个编译单元(*.o)中同时使用mal

c++ - Qt5 : error: 'WA_LockPortraitOrientation' is not a member of 'Qt'

我正在尝试将Qt4/Symbian项目编译为Qt5,同时保留对Qt4/Symbian的支持。目前MainWindow::setOrientation自动生成的样板函数给我带来了麻烦。它给我这些编译器错误:error:'WA_LockPortraitOrientation'isnotamemberof'Qt'error:'WA_LockLandscapeOrientation'isnotamemberof'Qt'error:'WA_AutoOrientation'isnotamemberof'Qt' 最佳答案 是的,正如您自己所说,这

c++ - 两阶段查找 : is it possible to easily mix inheritence and templates

简介:C++标准区分依赖模板参数的符号名称和不依赖模板参数的名称,这称为两阶段名称查找(参见here)。定义模板时,会尽快解析非相关名称。另一方面,从属名称仅在模板实例化时解析。示例:templatestructBase{typedefTtype;staticconstintn=3;virtualintf()=0;intf(intx){returnx*2;}};//doesn'tcompile!templatestructDerived:Base{typefield;//Thecompilerdoesn'tknowBase::typeyet!intf(){returnn;}//thec

c++ - Fedora 22 - 编译 - __atomic_is_lock_free

我尝试在Fedora22上编译一个软件(SuperCollider),但我遇到了一个问题:libsupernova.a(server.cpp.o):Infunction`std::atomic::is_lock_free()const':/usr/include/c++/5.1.1/atomic:212:undefinedreferenceto`__atomic_is_lock_free'collect2:error:ldreturned1exitstatusserver/supernova/CMakeFiles/supernova.dir/build.make:96:recipefo