草庐IT

current_index

全部标签

c++ - 将 std::type_index 作为模板参数传递给函数模板

考虑以下代码(工作正常):namespacefruit{structapple{};}namespacelanguage{structenglish{};}typedefstd::pairmyPairType;std::unordered_mapmyMap={{"paul",{"likes",std::type_index(typeid(fruit::apple))}},{"jonas",{"likes",std::type_index(typeid(language::english))}}};现在我有以下功能模板:templatevoidGenerateProfile(void*d

c++ - Windows::Storage::ApplicationData::Current 在 C++ 中找不到

我的C++代码,属于MediaFoundationTransform的一部分倾向于能够在WindowsStoreApp(Metro)中运行我修改了C++GrayscaleTransform以包含以下代码。但是,我的C++代码无法找到命名空间Windows::Storage。LPCWSTRzPath=Windows::Storage::ApplicationData::Current->TemporaryFolder->Path->Data();我需要做任何额外的设置吗?我可以通过打开使用Windows运行时扩展来编译它。但是通过这样做,它会给我额外的链接错误和警告。warningLNK

c++ - 与 std::current_exception 关联的数据的生命周期

考虑以下代码:std::exception_ptreptr{std::current_exception()};constchar*msg=0;try{if(eptr!=std::exception_ptr{}){std::rethrow_exception(eptr);}}catch(conststd::exception&ex){msg=ex.what();}我可以在catch之外使用msg吗?换句话说,ex是否引用与eptr相同的异常实例?谢谢! 最佳答案 rethrow_exception的描述说:Throws:theexc

c++ - 如何展开模板特化

我正在尝试使用模板元编程获取参数包中指定索引处的类型。我有下面的代码,但由于某种原因它总是返回一个int,有人能告诉我我做错了什么吗?#include#includeusingstd::cout;usingstd::endl;usingstd::string;templatestructTypeForIndex{};templatestructTypeForIndex:privateTypeForIndex{usingtype=Head;};templatestructTypeForIndex{usingtype=Tail;};intmain(){TypeForIndex::typea

c++ - 在 C++ 中,是否可以实现推进使 "current"元素无效的迭代器接口(interface)?

我正在设计一个C++接口(interface),允许用户迭代从文件解码的对象。这个解码过程有点慢。我正在考虑为此使用迭代器接口(interface),但我想避免任何不必要的复制,所以我正在考虑(用户方面):for(constauto&object:file){//youcanaccessthemembersof`object`herestd::cout前面使用示例中的object是对迭代器实例内部对象的引用。这是错的吗?您会在这里建议哪些其他惯用界面?我想到了一个流接口(interface)(想想std::istream),但是据我所知,读取数据的方法也返回拷贝(它们提取字符)。

c++ - 为什么 boost.geometry.index.rtree 比 superliminal.RTree 慢

我测试了boost.geometry.index.rtree(boost1.59www.boost.org)和superliminal.RTree(http://superliminal.com/sources/sources.htm#C_Code)。令我惊讶的是,superliminal.RTree比boost.geometry.index.rtree更快。环境设置将相同的空间索引数据添加到superliminal.RTree和boost.geometry.index.rtree对象。测试相同的空间索引查询100次并获得消耗的时间。GCC版本是“gccversion4.4.62011

c++ - CDT : "Setting up indexer" 期间发生内部错误

我将Eclipse与CDT结合使用来构建C++代码。加载我的工作区后,我收到以下消息:Aninternalerroroccurredduring:"Settingupindexer".这是日志:eclipse.buildId=I20110613-1736java.version=1.6.0_24java.vendor=SunMicrosystemsInc.BootLoaderconstants:OS=linux,ARCH=x86,WS=gtk,NL=en_USCommand-linearguments:-oslinux-wsgtk-archx86!ENTRYorg.eclipse.co

c++ - 如何在结构/类中获取有关 "current type"的信息?

是否有可能在struct中获取“当前struct的类型”?例如,我想做这样的事情:structfoobar{intx,y;booloperator==(constTHIS_TYPE&other)const/*WhatshouldIputhereinsteadofTHIS_TYPE?*/{returnx==other.x&&y==other.y;}}我试过这样做:structfoobar{intx,y;templatebooloperator==(constT&t)const{decltype(*this)&other=t;/*Wecanuse`this`here,sowecanget"

c++ - msvc "the breakpoint will not currently be hit"

MSVS2013:我有一个静态库的VC项目和C++代码,我想从我的exe项目中进入,它们位于同一解决方案中。但是,调试器一直告诉我它不会遇到断点,因为它无法根据静态库的调试符号加载(“当前不会遇到断点。没有为该文档加载任何符号”)。同一解决方案中的其他静态库工作。我最近刚刚添加了新的,因为我想进入其中的一些代码以查看出了什么问题。我添加了一个从exe到lib项目的构建依赖项,不知道这是否有任何影响,但我认为它不会造成伤害。我也尝试过清理和重建。什么可能是提示,什么是我没有得到的:为什么VS在获得源代码时首先尝试加载调试符号?有趣的是,我有一个不同的解决方案,也使用完全相同的静态lib项

成功解决使用git clone下载失败的问题: fatal: 过早的文件结束符(EOF) fatal: index-pack 失败

一.使用http可能出现的问题和解决1.问题描述~$gitclonehttps://github.com/oKermorgant/ecn_baxter_vs.git正克隆到'ecn_baxter_vs'...remote:Enumeratingobjects:13,done.remote:Countingobjects:100%(13/13),done.remote:Compressingobjects:100%(10/10),done.error:RPCfailed;curl56GnuTLSrecverror(-54):Errorinthepullfunction.fatal:Theremo