草庐IT

is_directory

全部标签

C++ 相关名称 : Is this typename required?

在a.hpp中我定义了:#includenamespaceBoard{templatestructGroupNode{usingPointType=std::pair;//...};}然后,在b.cpp中我定义了:#include"a.hpp"namespaceBoard{templatestructNodeList{usingStdList=std::list>;}}//andthenuseNodeListnl;上面的代码可以在没有任何警告的情况下在gcc-6和clang-3.9上编译。但是,Clion2016.3提示cannotresolvevariableGroupNodeinb

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++ - 测试 std::is_integral 和 std::is_signed?

我有一个函数,但我想将它分成两个函数,一个用于返回有符号整数,一个用于返回无符号整数。看起来像std::is_signed不是严格意义上的整数,所以我想我是否可以对类似std::is_integral::value&&std::is_signed::value的东西进行模板测试但这是行不通的。现在我将签名测试作为if语句:templatetypenamestd::enable_if::value,T>::typefoo(){if(std::is_signed::value){//signed}else{//unsigned}}编辑。我使用的是VisualStudio2010。实际上,看

c++ - 在 R 中使用 C++ 编译错误 : "RcppArmadillo.h: No such file or directory"

$exportPKG_CPPFLAGS=`Rscript-e'Rcpp:::CxxFlags()'`$exportPKG_LIBS=`Rscript-e'Rcpp:::LdFlags()'`$RCMDSHLIBmy.cppg++-I/usr/share/R/include-DNDEBUG-I/usr/local/lib/R/site-library/Rcpp/include-fpic-g-O2-fstack-protector--param=ssp-buffer-size=4-Wformat-Wformat-security-Werror=format-security-D_FORTI

c++ - Clang 提示 : "pointer is initialized by a temporary array"

我有一个不同长度的(指向)数组的数组,我了解到我可以使用复合文字来定义它:constuint8_t*constminutes[]={(constuint8_t[]){END},(constuint8_t[]){1,2,3,4,5END},(constuint8_t[]){8,9,END},(constuint8_t[]){10,11,12,END},...};gcc很好地接受了这一点,但clang说:指针由一个临时数组初始化,它将在完整表达式结束时被销毁。这是什么意思?代码似乎可以正常工作,但话又说回来,许多事情似乎在指向不再分配的内存时可以正常工作。这是我需要担心的事情吗?(最终我真

Visual Studio 2022: fatal error C1083: 无法打开包括文件: “crtdbg.h”: No such file or directory

1、报错内容fatal errorC1083:无法打开包括文件:“crtdbg.h”:Nosuchfileordirectory出现这个的主要原因是安装WindowsSDK时版本出错,需要根据自己的windows版本选择安装对应版本的WindowsSDKVS2022包括的版本如下:Windows版本WindowsSDK版本Windows10版本1903Windows10SDK版本1903(10.0.18362.1)Windows10版本2004Windows10SDK版本2004(10.0.19041.0)Windows10版本21H2Windows10SDK版本2104(10.0.20348

uniapp 小程序 使用 new FormData 报错,is not defined 问题解决(没解决)

newFormData只适用于web端,uniapp小程序不适用,这里当时也卡了一下,随便用个js文件发现其实FormData也使用不了,所以如果要配置formData的格式无法使用FormData,会报FormDataisnotdefined.解决原文原文原文1.安装fly:npminstallflyio2.使用renderjs3.Content-Type:‘application/x-www-form-urlencoded’最终代码:viewclass="nav_title"@click="custom.taskSycn">test/view>//注意renderjs方法的调用custom

c++ - 模板元编程 :why flat type is failure

我想将树型展平为平面型。示例:typedefstd::tuple,int>tup;Flat::type=>std::tuple我使用:templatestructFlat{usingtype=T;};templateclassC,typename...ARGS>structFlat>{usingtype=C;};templateclassC,typename...ARGS0,typename...ARGS1,typename...ARGS2>structFlat,ARGS2...>>:Flat>{};voidtest(){typedefstd::tuple,int>tup;static

c++ - 在 C++ 中 : Is const reference means "read-only view of" or it requires immutability of object being referenced?

问题可以通过示例表述如下:这段代码有效吗?inta=1;constint&ca=a;++a;//对于MSVC和MinGW,上面的代码片段按预期工作:如果我查询ca后记,它返回2(即它被非常量引用更改)。但问题是:如何从标准的角度考虑这种情况?我们是否可以更改对象,我们有const引用(或者例如,我们必须将ca定义为constvolatile引用以使代码片段正确)?所以,如果上面的片段是正确的,那么这意味着,const引用并不能保证引用的对象是常量。它只是禁止我们通过给定的引用来更改它,即建立引用对象的“只读”View。这是正确的吗?编辑:感谢所有回答我问题的人。答案说明了事情,这对我来

c++ - 带有 std::enable_if 和 std::is_default_constructible 的 SFINAE 用于 libc++ 中的不完整类型

我刚刚在使用SFINAE检测模板类型是否默认可构造时观察到libc++的一个奇怪问题。以下是我能够想出的一个最小示例:#include#includetemplatestructDummy;templatestructDummy{};templatestructhas_dummy:std::false_type{};templatestructhas_dummy>::value>>:std::true_type{};intmain(){std::cout{}(){}()它编译并输出预期的行true和false使用libstdc++使用g++或clang++编译时.但是,当我尝试使用li