草庐IT

is_readable

全部标签

c++ - 尝试实现 is_constexpr() - 编译器分歧

以下是基于RichardSmith实现is_constexpr()的三种尝试的answer至Isis_constexprpossibleinC++11?版本1templateboolconstexpris_constexpr_impl_1(constT&x,decltype(int{(x,0u)})){returntrue;}templateboolconstexpris_constexpr_impl_1(constT&,...){returnfalse;}templateboolconstexpris_constexpr_1(constT&x){returnis_constexpr_

c++ - SIMD : Why is the SSE RGB to YUV color conversion about the same speed as the c++ implementation?

我刚刚尝试优化RGB到YUV420转换器。使用查找表可以提高速度,就像使用定点算法一样。然而,我期待使用SSE指令获得真正的yield。我的第一次尝试导致代码变慢,并且在链接所有操作之后,它的速度与原始代码大致相同。我的实现是否有问题,或者SSE说明是否不适合手头的任务?部分原始代码如下:#defineRRGB24YUVCI2_000.299#defineRRGB24YUVCI2_010.587#defineRRGB24YUVCI2_020.114#defineRRGB24YUVCI2_10-0.147#defineRRGB24YUVCI2_11-0.289#defineRRGB24Y

c++ - Qt 5.5 和 Qt Installer Framework 2.0.1 : Logo is not displayed despite being present in config. xml

我已经使用预编译的QtInstallerFramework二进制文件2.0.1版为我的应用程序编写了一个安装程序。但是,安装程序窗口不会以任何可能的方式显示我的任何Logo。有问题的Logo名为“installerlogo.png”,这是一个带有alphachannel的64x64图像,位于安装程序目录结构的顶部(与config/和packages/目录所在的目录相同。)为了图标的目的我又做了一个logo,名字叫“installericon.ico”,就是上面那个的16x16版本,只是简单的重命名为“.ico”(是不是做法不对?)我在config.xml文件中尝试了以下内容:insta

c++ - std::is_signed 不适用于强类型枚举:int

谁能解释一下,为什么#include#includeusingnamespacestd;enumE:signedint{a=-1,b=1,};intmain(){std::cout()std::is_signed不做,锡上写的是什么?谢谢... 最佳答案 如果我们查看is_signed的文档它说:IfTisasignedarithmetictype,providesthememberconstantvalueequaltrue.Foranyothertype,valueisfalse.并且枚举不是算术类型,因此结果应该为假。来自C+

c++ - "-ftrapv"和 "-fwrapv": Which is better for efficiency?

来自GNU的网站:-ftrapvThisoptiongeneratestrapsforsignedoverflowonaddition,subtraction,multiplicationoperations.-fwrapvThisoptioninstructsthecompilertoassumethatsignedarithmeticoverflowofaddition,subtractionandmultiplicationwrapsaroundusingtwos-complementrepresentation.Thisflagenablessomeoptimizationsa

c++ - 为什么 std::is_array 对 std::array 返回 false?

自std::array和std::is_array都是在C++11中引入的,编译失败似乎很奇怪:#include#includestatic_assert(std::is_array>::value);有没有一种简单的方法来检查某物是否是一个数组,包括T[N]的两种可能性?和std::array? 最佳答案 std::is_array仅对看起来像T[]的类型定义为真或T[N].std::array不包括在内。您不能修改或专门化std::is_array成为true_type对于std::array在标准之下;这会使您的程序格式错误,

C++ 错误 : Type Name is Not Allowed

我正在尝试学习指针参数中的新类(class),我想让函数senior和everyoneElse接受指针x,但是当我尝试使用指针pAge调用函数时,它显示错误:类型名称是不允许的。怎么了?#includeintsenior(int*x);inteveryoneElse(int*x);usingnamespacestd;intmain(){intage(0);int*pAge(&age);cout>age;if(age>59)senior(int*pAge);elseeveryoneElse(int*pAge);return0;}intsenior(int*x){return*x;}int

c++ - std::is_signed<T> 和 std::numeric_limits<T>::is_signed 之间的区别?

两者都是std::is_signed和std::numeric_limits::is_signed应该给出关于T的签名的答案.为什么现在有两个符号指示符(即自C++11起)? 最佳答案 我敢猜测唯一的区别是如果std::numeric_limits专门用于用户定义的类型。这样的用户定义类型当然可以为is_signed提供自己的值。.但要求std::is_signed::value在这种类型上将始终返回false除非std::is_signed已独立特化。似乎std::is_signed的条件代表是is_arithmetic::val

c++ - 由空指针常量 : which behaviour is correct? 初始化

intmain(){constintx=0;int*y=x;//line3int*z=x+x;//line4}引用标准(C++11§4.10/1)Anullpointerconstantisanintegralconstantexpression(5.19)prvalueofintegertypethatevaluatestozerooraprvalueoftypestd::nullptr_t.Anullpointerconstantcanbeconvertedtoapointertype;...有四种可能:第4行没问题,但第3行不行。这是因为x和x+x都是计算结果为0的常量表达式,但

C# Dll 导入失败 : "The application has failed to start because its side-by-side configuration is incorrect"

我有一个c#.net4应用程序,使用vs2010。我正在尝试导入一个c++dll(基于vs2005)。[DllImport("Card.dll")]我得到了失败:UnabletoloadDLL'Card.dll':Theapplicationhasfailedtostartbecauseitsside-by-sideconfigurationisincorrect.Pleaseseetheapplicationeventlogorusethecommand-linesxstrace.exetoolformoredetail.(ExceptionfromHRESULT:0x800736B