草庐IT

egg-info

全部标签

c++ - 从 std::type_info 检索数据类型的大小

在C++03中,当您使用运算符typeid时,一个type_info返回对象。是否可以仅根据此结果检索给定类型的大小,例如由sizeof返回的运营商?例如:std::type_infoinfo=typeid(int);intintSize=sizeof(int);intintSize2=info.getSize();//doesn'texist!问题是我们使用第三方多数组类返回类型信息,但不返回类型的大小。 最佳答案 我能看到的最好方法(我想被证明是错误的)是预先注册类型,如下所示:#include#include#include#

c++ - type_info 不是 RTTI 的一部分吗?

我问了一个问题DoC++PODtypeshaveRTTI?有人在评论中告诉我:PODtypesdohavetype_info,butdon'thaveRTTI,andthat'spossiblebecausetype_infoisn'talwaysRTTI.这似乎是正确的,因为我可以获得POD(非多态)类型的type_info。但是当我编译这个简单的程序时:#includestructX{inta;};intmain(){usingnamespacestd;std::cout带有GCC的标志-fno-rtti:$g++-fno-rttimain.cpp&&./main它不会编译:mai

c++ - boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error>>

我需要一些帮助来解决这个异常,我正在实现一个NPAPI插件,以便能够使用来自浏览器扩展的本地套接字,为此我正在使用Firebreath框架。对于套接字和连接,我使用带有异步调用的Boostasio和一个包含5个工作线程的线程池。我还为每个线程设置了截止日期以实现传输超时。我使用插件的扩展工作流程是这样的:打开套接字1(这会启动async_receive和截止时间异步等待)写入套接字1获取响应1打开另一个socket2在套接字2中写入写套接字1关闭套接字1(socket.cancel(),deadline.cancel(),socket.shutdown(),socket发布)。获取响应

c++ - typeid/type_info 奇怪的行为

为什么下面的例子:#include#includetemplatevoidfun(constT¶m){std::cout给出以下输出:Tisiparamisi1我知道type_info::name()行为依赖于实现。无论如何,我希望operator==返回false(因为param是一个const引用,而不是一个整数)。 最佳答案 这是在标准中定义的:5.2.8/5:Ifthetypeoftheexpressionortype-idisacv-qualifiedtype,theresultofthetypeidexpress

c++ - 为什么 type_info::name() 未指定?

我完全知道std::type_info::name()的返回值是实现定义的。来自C++标准(ISO/IEC14882:2003§18.5.1.7):Returns:animplementation-definedNTBS.我的问题是:为什么?如果标准规定了返回值应该是什么,这个成员函数不是更有用吗? 最佳答案 基本上,如果一个实现决定他们不能或不想支持RTTI,他们可以return"";。如果标准强制它返回某些东西,他们可能会扼杀任何为RTTI资源不存在或想要禁用的环境(例如微芯片)提供兼容编译器的能力。别忘了我们不想在任何编译器上

c++ - std::type_info::hash_code() 的唯一性和 "should"的含义

是否意味着要保证相同的std::type_info::hash_code()值表示相同的类型?Cplusplus.com似乎是这么说的:Thisfunctionreturnsthesamevalueforanytwotype_infoobjectsthatcompareequal,anddifferentvaluesfordistincttypesthatdonot.[Emphasismine]Cppreference似乎另有说法:Returnsanunspecifiedvalue,whichisidenticalforobjects,referringtothesametype.No

c++ - typeid 何时可以为同一类型返回不同的 type_info 实例?

AndreiAlexandrescu写入ModernC++Design:Theobjectsreturnedbytypeidhavestaticstorage,soyoudon'thavetoworryaboutlifetimeissues.安德烈继续说道:Thestandarddoesnotguaranteethateachinvocationof,say,typeid(int)returnsareferencetothesametype_infoobject.尽管标准不保证这一点,但在GCC和VisualStudio等常见编译器中如何实现这一点?假设typeid没有泄漏(并且每次调

python - Windows 上的 GoogleScraper - 错误 setup.py egg_info

我在使用python安装GoogleScraper时遇到问题。我搞不清楚了。看看我的问题:CaptureFile"C:\Python34\lib\distutils\command\build_py.py",line55,infinalize_optionsself.package_dir[name]=convert_path(path)File"C:\Python34\lib\distutils\util.py",line127,inconvert_pathraiseValueError("path'%s'cannotendwith'/'"%pathname)ValueError:p

Python 无法打开 C :\Windows\System32\oobe\Info\backgrounds 中的文件

Windows7x64,Python2.7。试图制作一个脚本来自动更改登录背景。我正在使用pygame,它是python的SDL包装器,但代码应该是不言自明的:importpygameimportosimage=pygame.image.load(os.path.normpath("C:/Users/nivekuil/Desktop/backgroundDefault.jpg"))surface=pygame.Surface((1366,768))surface.fill((255,255,255))surface.blit(image,(0,0))surface=pygame.ima

windows - Cygwin 错误 : "child_info_fork::abort: Loaded to different address:"

我正在尝试在Windows-7上使用cygwin-x86(32位版本)构建我的软件。Cygwin-x64(64位)在同一台机器上运行良好。我想构建32位可执行文件。每当我尝试cygwin-x86时,我都会收到以下错误:[main]make7780child_info_fork::abort:C:\cygwin\bin\cygiconv-2.dll:Loadedtodifferentaddress:parent(0x440000)!=child(0x5F0000)make:fork:Resourcetemporarilyunavailable我已经检查了这个线程CygwinError我已