草庐IT

basic_feature_names

全部标签

c++ - 为什么这个编译器错误? - 没有匹配函数调用 'std::basic_ofstream<char>::open(std::string&)'

这适用于VisualStudio,并且适用于一台计算机上的GCC4.9.2。但在不同的计算机上,我认为它是相同的GCC4.9.2编译器,但它给了我这个错误。我错过了什么吗?怎么回事?#include#include#includeusingnamespacestd;intmain(){stringfilename;filename="teststring";ofstreamfout;fout.open(filename);fout.||===Build:Debuginfileiotest(compiler:TDM32GNUGCCCompiler4.9.2dw2)===|F:\Users

c++ - (C++14) lambda 数组 : error: 'name' declared as array of 'auto'

我很难解决这个错误。我承认,我是C++的新手,我的困难来自于不理解错误消息。代码如下:autoselectionFuncs[8]={[&](constVector3&min,constVector3&max){returnmax.x_==seamValues.x_||max.y_==seamValues.y_||max.z_==seamValues.z_;},[&](constVector3&min,constVector3&max){returnmin.x_==seamValues.x_;},[&](constVector3&min,constVector3&max){returnm

c++ - c++11 中的 typeid(T).name() 替代方案?

在c++11中是否有一种标准的方法来使用一些模板黑魔法或动态地使用一些标准库函数来获取类的名称? 最佳答案 不,但你可以做一个:templatestructmeta{staticconststd::string&get_name(){returnT::class_name;}};然后将静态成员class_name添加到类中:classMyClass{public:staticconststd::stringclass_name("MyClass");};或专门化元:templatestructmeta{staticconststd:

c++ - 提升精神 : how to convert basic types?

假设我有一个std::string属性,但为了便于解析,我想使用qi::int_或qi::double_.是否有一种简单的方法可以将转换作为语义操作进行?我试过这样的:std::stringstreamss;my_int_as_str=qi::int_[ref(ss)但这甚至无法编译。编辑-尝试使用下面sehe的回答#include#include#include#includenamespaceqi=boost::spirit::qi;namespacephx=boost::phoenix;intmain(intargc,char*argv[]){std::stringtest="1

c++ - "Expected class-name"...析构函数实现中的问题

我正在尝试实现堆栈和队列。我还获得了用于测试堆栈和队列的代码(以查看它们各自的功能是否正常工作)。我已经实现了stack和quete的功能,但是在尝试编译它们时出现错误:在析构函数“Stack::~Stack()”中'('标记前的预期类名在他们两个。以下是通用的Stack类:templateclassStack{Listlist;public:Stack();Stack(constStack&otherStack);~Stack();}列表类:templateclassList{ListItem*head;public:List();List(constList&otherList);

从[parendid,name]目录dict到完整的路径dict

我有一个目录的命令[parentid,name]像这样:D={0:[-1,'C:'],1:[0,'BLAH'],2:[0,'TEMP'],3:[1,'BOOO'],4:[1,'AZAZ'],5:[2,'ABCD']}我想从这途径到完整的道路:FULLPATHS={}forkey,pathinD.iteritems():newpath=path[1]ifpath[0]!=-1:newpath=FULLPATHS[path[0]]+'\\'+newpathFULLPATHS[key]=newpath有用:{0:'C:',1:'C:\\BLAH',2:'C:\\TEMP',3:'C:\\BLAH\\

vue3+vite+typescript出现does not provide an export named ‘xxx‘ 解决方法

vue3+vite+typescript出现doesnotprovideanexportnamed‘xxx’解决方法。在使用TinyMCE富文本组件时,出现以下错误:Therequestedmodule‘/src/main/ts/components/EditorPropTypes.ts?t=1674647216370’doesnotprovideanexportnamed‘IPropTypes’。对应EditorPropTypes.ts中的代码:exportinterfaceIPropTypes{apiKey:string;cloudChannel:string;id:string;init

c# - 是否有与 boost::interprocess::basic_string 等效的 C#?

在C++中,您可以使用boost::interprocess定义一个boost::interprocess::basic_string,它基本上是对存储在内存映射文件中的字符串的抽象。您可以像在您的应用程序中使用任何其他字符串一样无缝地使用它(当然假设您注意线程安全)。是否有任何等效的C#库/nuget包/代码段? 最佳答案 没有。但是,即使可以透明地实现,C#中的字符串也是不可变的。因此,我认为拥有一个像那样的图书馆甚至不会非常有用。 关于c#-是否有与boost::interproc

【vue运行报错】There are multiple modules with names... 报错原因和解决办法

项目场景:Therearemultiplemoduleswithnamesthatonlydifferincasing.项目运行时候报错如下:Therearemultiplemoduleswithnamesthatonlydifferincasing.:有多个模块同名仅大小写不同。Thiscanleadtounexpectedbehaviorwhencompilingonafilesystemwithothercase-semantic.:这可能导致在一些文件系统中产生不是预期的行为。Useequalcasing.:使用唯一的写法。问题描述vue运行时项目报错:Therearemultiple

c++ - 什么时候用 "class_name obj_name = func()"替换 "class_name obj_name{func()}"有意义?

在代码中我看到了以下结构:constclass_nameobj_name{func()};func()返回名为class_name的类的对象。所以,我想知道为什么不使用以下结构:constclass_nameobj_name=func(); 最佳答案 constclass_nameobj_name{func()};作者通过写上面的代码,试图遵循统一初始化语法(C++11引入),从而避免繁琐的解析和最令人烦恼的解析,即使是经验丰富的程序员也会意外陷入其中。他正试图将最佳实践灌输到他的大脑中,这样他就不会偶尔陷入上述解析问题,如下所述。