草庐IT

exception_type

全部标签

c++ - typedef type * type::* ,它是什么?

我有以下代码:structmyType{myType*ptr;};typedefmyType*myType::*other_type;第二行typedef'ining是什么?这是一个返回myType指针或其他东西的成员函数吗? 最佳答案 将other_type定义为指向myType成员的指针,其中所述成员本身是指向myType的指针。例如,您可以这样使用它:other_typex=&myType::ptr;myTypemine;mine.*x=&mine;为什么你会这样做,我不能说。 关

c++ - 我可以修改 std::exception_ptr 中异常的值吗?

如果我在std::exception_ptr中存储了一个异常。我使用std::rethrow_exception重新抛出异常,使用catch(MyException&)访问它,然后修改值。如果我再次抛出相同的异常,我是否应该观察我所做的修改?下面的代码展示了我的想法:#include#includestructMyException{intvalue;};intmain(){std::exception_ptra=std::make_exception_ptr(MyException());try{std::rethrow_exception(a);}catch(MyException

c++ - 为什么 unordered_set 操作像计数和删除返回一个 size_type?

显然,unordered_set::erase和unordered_set::count返回一些不是严格bool值的东西(从逻辑上讲,也就是说,我不是在谈论实际类型)。链接页面读取第三个版本的删除:size_typeerase(constkey_type&key);Removestheelementswiththekeyvaluekey这有一种语气,表明可能不止一个元素具有给定的键。它没有明确说明这一点,但听起来很像。现在,集合(即使是无序集合)的要点是每个元素都有一次。标准库承认bool类型的存在并将其用于bool值,如unordered_set::empty().那么,在上述情况下

c++ - 模板元编程 :why flat type is failure

我想将树型展平为平面型。示例:typedefstd::tuple,int>tup;Flat::type=>std::tuple我使用:templatestructFlat{usingtype=T;};templateclassC,typename...ARGS>structFlat>{usingtype=C;};templateclassC,typename...ARGS0,typename...ARGS1,typename...ARGS2>structFlat,ARGS2...>>:Flat>{};voidtest(){typedefstd::tuple,int>tup;static

c++ - LoadLibrary 失败 : First chance exception 0xC0000139 (DLL Not Found) - How to debug?

我有一个dll“mytest.dll”,当通过LoadLibrary()加载时,返回NULL(并且127作为GetLastError())。如果我在“mytest.dll”上使用DependencyWalker,它会报告它应该正确加载并且正确找到所有DLL。在主机exe上运行DependencyWalker的探查器选项会在日志中显示以下相关部分:00:00:55.099:Loaded"mytest.DLL"ataddress0x07860000bythread0xBBC.Successfullyhookedmodule.00:00:55.115:Firstchanceexception

c++ - 影响和异常(exception)

假设我有以下功能:SomeTypecreateSomeType();根据某些原因可以抛出。然后:SomeTypeval=SomeType();//initialvaluetry{val=createSomeType();//here}catch(std::exception&){}如果createSomeType()抛出异常,我是否可以始终假设val值未更改? 最佳答案 是的,如果createSomeType()抛出异常,赋值将不会发生。控制流将从throw语句开始,通过createSomeType()在堆栈上拥有的任何对象的析构函

c++ - 外部关键字 "missing type specifier"

我正在使用VisualC++Express创建一个DLL,并且在声明时externValveInterfaces*VIFace在Required.h中,编译器告诉我ValveInterfaces没有定义。(我想将VIFace暴露给任何文件,包括Required.h)这是我的文件结构:DLLMain.cpp#include"Required.h"//requiredheaderfiles,suchasWindows.handtheSDKValveInterfaces*VIFace;//therestofthefileRequired.h#pragmaonce//includeWindow

2023版idea ssh 远程linux docker 报错: Only key-pair ssh auth type is supported for docker connections.

2023版ideassh远程linuxdocker报错:Cannotconnect:java.lang.llegalArgumentException:Onlykey-pairsshauthtypeissupportedfordockerconnections.环境:idea2023.3.2centos7安装docker报错截图:正确操作步骤:idea选择连接方式ssh点“+”号依次填入信息,点击“testConnection”,初次会报错,参考第4步报错,可以忽略,点击“OK”依次点击“Apply”,点击“OK”,关闭此界面下面的弹窗也“OK”关闭双击此处“Docker”,即可连接成功,再次

c++ - 为什么 std::allocator<>::deallocate() 有一个未使用的 size_type 参数?

使用std::allocator时,deallocate函数需要pointer参数,和一个size_type参数(std::allocator::deallocate(std::allocator::pointerp,std::allocator::size_type)。但是,没有使用size_type,也不是可选的。那么为什么它在那里?这让我很困惑,因为它应该是可选的,甚至不在那里,因为它没有在函数中使用.编辑:MSVC的分配器实现deallocatevoiddeallocate(pointer_Ptr,size_type){//deallocateobjectat_Ptr,igno

C++1y/C++14 : Converting static constexpr array to non-type template parameter pack?

假设我有一个静态存储持续时间的constexpr数组(已知范围):constexprTinput[]=/*...*/;我有一个需要打包的输出类模板:templatestructoutput_template;我想像这样实例化output_template:usingoutput=output_template;一种方法是:templatestructmake_output_template{templatestaticconstexproutput_templatef(std::index_sequence){return{};};usingtype=decltype(f(std::m