草庐IT

has_rkey

全部标签

c++ - 在 vs2008 SP1 中禁用检查迭代器时出现问题 (_HAS_ITERATOR_DEBUGGING=0)

当我尝试禁用已检查的迭代器时,在Debug模式下运行vs2008SP1时遇到了一些问题。以下程序重现了该问题(字符串析构函数崩溃):#define_HAS_ITERATOR_DEBUGGING0#includeintdo_stuff(std::stringconst&text){std::string::const_iteratori(text.end());return0;}intmain(){std::ostringstreamos;os我找到了similarpost在gamdev.net上讨论了在vs2005中遇到这个问题。该帖子中的示例程序在2008SP1上按原样为我编译-但是

c++ - 'struct std::pair<int, int >' has no member named ' 序列化'

我正在尝试将序列化集成到我的代码中。但是,我收到“没有命名的成员”错误。我正在阅读的书说std::pair不需要包含头文件并且不存在。如何修复此错误?我的代码如下所示:#include//ofstream/ifstream#include#include#include//stringstream#include//#include#include//#includeusingnamespacestd;intmain(){complexc(1,0);bitsetb(BOOST_BINARY(101));pairp(1,2);strings;std::stringstreamss(s);

c++ - 使用以下 has_member 函数时 SFINAE 无法正常工作的原因是什么?

我正在尝试来自WalterBrown'sTMPtalk的示例我正试图让他的has_member实现正常工作。然而,该实现似乎错误地返回true,这让我相信我不理解SFINAE的一些细节。#include#includetemplateusingvoid_t=void;templatestructhas_type_member:std::false_type{};templatestructhas_type_member>:std::true_type{};structFooWithType{typedefinttype;};structFooNoType{};intmain(){std

Ms Visual Studio : "Windows has triggered a breakpoint in javaw.exe" 上的 C++ 错误

我一直致力于我的软件C++和Java(使用MicrosoftVisualStudio2008和Eclipse构建),并且我一直在尝试将它从32位系统转移到64位系统。编译阶段没问题,但在执行时出现错误:"Windowshastriggeredabreakpointinjavaw.exe.Thismaybeduetocorruptionoftheheap,whichindicatesabuginjavaw.exeoranyoftheDLLsithasloaded-.ThismayalsobeduetouserpressingF12whilejavaw.exehasfocus.Theout

c++ - 使用 mingw-w64 工具链时,以 Release模式链接的 Regex Boost 库会发出 "duplicate section has different size"警告

在Release模式下链接我的项目时,我收到以下警告:myProject-libs/release/libboost_regex-mt-s-1.50.0.a(cpp_regex_traits.o):duplicatesection`.data$_ZZN5boost16cpp_regex_traitsIcE21get_catalog_name_instEvE6s_name[boost::cpp_regex_traits::get_catalog_name_inst()::s_name]'hasdifferentsize我怀疑原因可能是boost库的编译选项与我在项目中使用的选项不同,但我

c++ - 错误 : 'std::this_thread' has not been declared

我尝试使用std::this_thread::sleep_for()函数但出现错误错误:“std::this_thread”尚未声明。包含标志_GLIBCXX_USE_NANOSLEEP。还需要什么来强制它工作?MinGW==>gcc版本4.7.2(GCC)中南合作:#includeintmain(){std::this_thread::sleep_for(std::chrono::seconds(3));}命令行:g++-D_GLIBCXX_USE_NANOSLEEP-std=gnu++0xssce.cpp-ossce.exe编译结果:ssce.cpp:Infunction'intm

c++ - "temporary of type ' A ' has protected destructor", 但它的类型是 B

在以下代码中,使用Clang8.0.0+和-std=c++17编译,使用B{}创建派生类实例会报错错误:'A'类型的临时对象具有protected析构函数。当临时文件的类型为B(因此应该有一个公共(public)析构函数)时,为什么A会出现在此消息中?https://godbolt.org/z/uOzwYaclassA{protected:A()=default;~A()=default;};classB:publicA{//canalsoomitthese3lineswiththesameresultpublic:B()=default;~B()=default;};voidfoo(

c++ - Qt Creator编译错误 "::swprintf and::vswprintf has not been declared"

到目前为止,我已经在visualstudio中编写了所有代码,现在我需要向其中添加一些UI,因此我将使用Qt。所以我在我的项目中添加了每个文件(主类除外),然后尝试使用Qt编译它。因为我使用了一些c++0x特性,所以我不得不将这一行添加到项目文件中:QMAKE_CXXFLAGS+=-std=c++0x然后我尝试编译它。只有两个错误(可能还有更多,但编译器在这两个上停止)Infileincludedfromd:\qt\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,fromd:\qt\mingw\bin\

c++ - 错误 : '' has not been declared

我正在尝试实现链表,但在编译时出现错误:intSLLst.cpp:38:error:‘intSLList’hasnotbeendeclaredintSLList看起来好像已经向我声明了,所以我真的很困惑。intSLLst.cpp#include#include"intSLLst.h"intintSLList::deleteFromHead(){}intmain(){}intSLLst.h#ifndefINT_LINKED_LIST#defineINT_LINKED_LIST#includeclassIntSLLNode{intinfo;IntSLLNode*next;IntSLLNod

c++ - 定义 _HAS_TRADITIONAL_STL 以启用 STL 功能是否安全?

试图使用std::select1st来自在一个VS2008项目中,我发现它被_HAS_TRADITIONAL_STLifdef输出了。守卫。有这样的原因吗?简单地定义_HAS_TRADITIONAL_STL是否安全?在包括之前? 最佳答案 默认情况下std::select1st不存在的原因是它不是C++标准库的一部分。它是未被C++标准采用的标准模板库(STL)的一部分。我在MSDN上找不到关于_HAS_TRADITIONAL_STL的任何文档,它似乎没有用在随VisualStudio2010分发的标准库版本中。它可能包含在Dink