草庐IT

Parameter1

全部标签

c++ - 视觉 C++ :error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char [260]' to 'LPWCH'

当我尝试编译我的项目时,我遇到了一些我无法解决的错误。无论如何这是代码之一:public:voidInit(HMODULEhModule,stringFilename){charszLoc[MAX_PATH];GetModuleFileName(hModule,szLoc,sizeof(szLoc));char*dwLetterAddress=strrchr(szLoc,'\\');*(dwLetterAddress+1)=0;strcat(szLoc,Filename.c_str());__OutStream.open(szLoc,ios::app);}错误是:errorC2664:

c++ - 可变参数模板 : Pass parameter pack without expansion

旧的Cstdio工具提供了一种使用vprintf工具传递可变参数集的方法。是否有类似的方式来传递C++0x可变模板参数包而不扩展它?如果您有一个采用可变参数模板参数包的派生类构造函数,并且需要简单地将其传递给基类构造函数,而不是将其解包,这可能会很有用。例如:templateBase::Base(constT&v,constArgs&...args){/*...expandargshere....*/}templateDerived::Derived(constT&v,constArgs&...args):Base(v,args){/*...don'texpandargs...*/}我

c++ - cmake -D <变量> :<type>=<value> what does the parameter "-D" mean

我正在尝试使用cmake安装opencv。在opencv说明页面中,我找到以下示例:cd~/opencvmkdirreleasecdreleasecmake-DCMAKE_BUILD_TYPE=RELEASE-DCMAKE_INSTALL_PREFIX=/usr/local..据我了解,我应该在我创建的新目录中使用cmake生成Makefile,在这个例子中应该是~/opencv/release。但我不太明白最后一行。在cmake帮助中,我发现:cmake-D:==createacmakecacheentry这是什么意思?特别是这部分:":=",我不明白为什么这个例子给出了"CMAKE

C++ 错误 : deduced conflicting types for parameter 'T' string vs const char *

因此,我正在为双端队列容器编写一个简单的模板化搜索函数。这是代码:templatevoidsearchInDequeFor(std::dequeDeque,TsearchValue){for(constauto&element:Deque){if(Deque.empty()){std::cout下面是我在main中调用函数的方式:dequemyDeque={"apple","banana","pear","blueberry"};searchInDequeFor(myDeque,"pear");这是我遇到的错误:candidatetemplateignored:deducedconfl

c++ - vector 声明 "expected parameter declarator"

这个问题在这里已经有了答案:Whycan'tmemberinitializersuseparentheses?(2个答案)关闭5个月前。我在类的私有(private)成员变量中有一行代码:vectordQdt(3)在xcode中编译时,会出现错误“expectedparameterdeclarator”。我想我提供了足够的信息。我认为此声明没有任何问题。

c++ - 错误 : argument of type char* is incompatible with parameter of type LPCWSTR

#include#includeusingnamespacestd;intmain(){char*file="d:/tester";WIN32_FIND_DATAFindFileData;HANDLEhFind;hFind=FindFirstFile(file,&FindFileData);//lineoferrorsaysargumentoftypechar*isincompatiblewithparameteroftypeLPCWSTR}我无法理解错误。错误是什么以及如何解决错误?我正在制作一个控制台应用程序,需要检查目录中是否有文件。 最佳答案

c++ - 模板特化站点报告 "too few template-parameter-lists"错误

代码某处有错误,但我不知道如何解决。它说“模板参数列表太少”。我不明白哪个是错误的。代码如下:#if!defined(VECTOR_H_INCLUDED)#defineVECTOR_H_INCLUDED#include//forsize_tnamespaceVec{classVector_base{public:explicitVector_base(){}};templateclassVector:publicVector_base{typedefVectorME;explicitVector(T,T,T);doubledot(constME&v)const;T&operator[]

c++ - template-parameter-list of template parameter 是什么意思

引用3.3.9/1中的一句话:Thedeclarativeregionofthenameofatemplateparameterofatemplatetemplate-parameteristhesmallesttemplate-parameter-listinwhichthenamewasintroduced.你能举个例子来理解上面的定义吗?我也想知道模板参数的模板参数列表是什么意思?示例会有所帮助。 最佳答案 template//thedeclarativeregionendshereclassq//hencethenamema

C++1y/C++14 : Converting static constexpr array to non-type template parameter pack?

假设我有一个静态存储持续时间的constexpr数组(已知范围):constexprTinput[]=/*...*/;我有一个需要打包的输出类模板:templatestructoutput_template;我想像这样实例化output_template:usingoutput=output_template;一种方法是:templatestructmake_output_template{templatestaticconstexproutput_templatef(std::index_sequence){return{};};usingtype=decltype(f(std::m

C++ 风格约定 : Parameter Names within Class Declaration

我是一个相当新的C++程序员,我想听听支持和反对在类声明中命名参数的争论。这是一个例子:Student.h#ifndefSTUDENT_H_#defineSTUDENT_H_#includeusingnamespacestd;classStudent{private:stringname;unsignedintage;floatheight,GPA;public:Student(string,unsignedint,float,float);voidsetAge(unsignedint);};#endif/*STUDENT_H_*/对比#ifndefSTUDENT_H_#defineS