草庐IT

named_scope

全部标签

c++ - 应该使用哪个 header 来使用 scoped_ptr

我想在我的C++应用程序中使用智能指针。使用stdscoped_ptr应该包含哪个头文件? 最佳答案 标准C++库中没有scoped_ptr。全部C++11smartpointers在标题中.如果你想要boost::scoped_ptr那么你需要boost/scoped_ptr.hpp. 关于c++-应该使用哪个header来使用scoped_ptr,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/q

vscode打开Python项目 ModuleNotFoundError: No module named

方法1、cmd+shift+p,选择openusersettings"terminal.integrated.env.osx":{"PYTHONPATH":"${workspaceFolder}/",},"terminal.integrated.env.linux":{"PYTHONPATH":"${workspaceFolder}/",},"terminal.integrated.env.windows":{"PYTHONPATH":"${workspaceFolder}/",},这段配置在VSCode中起到了设置Python运行环境的作用。具体来说,它设置了在不同操作系统下集成终端的环境变

C++ 错误 : ‘_mm_sin_ps’ was not declared in this scope

我正在尝试对将函数应用于数组的不同方法进行基准测试。为什么是https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=3260,2124,4779,4779&cats=Trigonometry&text=_sin_mm_sin_ps在我的范围内未知,但_mm_sqrt_ps是?我如何让它为人所知?并编译无误。#include#include#include#include#include#include#include"immintrin.h"#includeintmain(){std::coutdis(-

c++ - 枚举 "does not name a type' 的问题

g++(Ubuntu/Linaro4.4.4-14ubuntu5)4.4.5我有一个问题,我似乎找到了我得到这个错误的方法。文件statemachine.h#ifndefSTATEMACHINE_H_INCLUDED#defineSTATEMACHINE_H_INCLUDED#include"port.h"enumstate{ST_UNINITIALIZED=0x01,ST_INITIALIZED=0x02,ST_OPENED=0x03,ST_UNBLOCKED=0x04,ST_DISPOSED=0x05};voidstate_machine(eventevt,port_t*port)

c++ - 错误 : ‘i’ does not name a type with auto

这个问题在这里已经有了答案:HowdoIenableC++11ingcc?(4个答案)关闭7年前。我是C++新手,这是我的程序#include#include#include#include#includeintmain(){staticconstdoublearr[]={16.0,2.2,77.5,29.0,24.0};std::vectorvec(arr,arr+sizeof(arr)/sizeof(arr[0]));std::transform(vec.begin(),vec.end(),vec.begin(),bind2nd(std::minus(),3.0));for(aut

c++ - 错误 : '...' does not name a type

我有一个工作项目。重新安排一些代码后,我尝试重新编译我的项目,然后奇怪的事情开始发生。查看编译器输出的这段摘录。我正在使用MinGWG++从Windows上的Eclipse进行编译。****BuildofconfigurationDebugforprojectPract2********InternalBuilderisusedforbuild****g++-O0-g3-Wall-c-fmessage-length=0-omove.o..\move.cppInfileincludedfrom..\/game.h:11:0,from..\/piece.h:10,from..\/move.

c++ - 继承 : expected class-name before ‘{’ token

我试图在C++中创建一个异常类,但它不起作用。我已将代码减少到最少,但仍然找不到错误。这是我的头文件:#ifndefLISTEXCEPTION_H#defineLISTEXCEPTION_H//C++standardlibraries#include/*CLASSDEFINITION*/classListException:publicexception{};#endif//LISTEXCEPTION_H这是我得到的错误:error:expectedclass-namebefore‘{’token这是出乎意料的。我该如何解决这个问题? 最佳答案

c++ - QScopedPointer、boost::scoped_ptr - 为什么提示类型不完整?

我有一个c-Structure,我想将它嵌入到一个cpp类中而不破坏我的全局命名空间,所以我不想包含c-header。这就是为什么我想使用具有前向声明结构名称的智能作用域指针(QScopedPointer或boost::scoped_ptr)。我不明白的是上述两个在编译时失败的作用域指针的实现:boost:errorC2027:useofundefinedtype'xxx'templateinlinevoidchecked_delete(T*x){//intentionallycomplex-simplificationcausesregressionstypedefchartype_

c++ - 指向 typeinfo::name() 的内存的生命周期是多少?

在C++中,我可以使用typeid运算符来检索任何多态类的名称:constchar*name=typeid(CMyClass).name();返回的constchar*指针指向的字符串对我的程序可用多长时间? 最佳答案 只要带有rtti的类存在。因此,如果您处理单个可执行文件-永远。但是对于动态链接库中的类,它会发生一点变化。可能你可以卸载它。 关于c++-指向typeinfo::name()的内存的生命周期是多少?,我们在StackOverflow上找到一个类似的问题:

C++ 继承 : scoping and visibility of members

你能解释一下为什么这是不允许的吗,#includeclassB{private:inta;public:inta;};intmain(){return0;}这是什么时候?#includeclassA{public:inta;};classB:publicA{private:inta;};intmain(){return0;}在这两种情况下,我们在classB中都有一个名为a的公共(public)变量和一个私有(private)变量。现在编辑! 最佳答案 Inboththecases,wehaveonepublicandonepriv