草庐IT

Block-scoped

全部标签

c++ - 转换为 JPEG 时损坏的 HEIC 图 block

我在将.HEIC图像转换为jpeg时遇到问题。.HEIC文件是用运行最新ios公测版的iphone拍摄的图像。我正在使用librarynokiaprovided解析文件并从.HEIC文件中提取图像block,将它们转换为jpeg并使用ffmpeg/montage将它们粘合在一起。有太多代码无法将其全部粘贴到这个问题中,所以我将所有代码都放在这个githubrepo中.它非常不言自明,只需几个依赖项就可以运行。它们在repo的README中有解释。顺便说一下,这一切都是在osx上完成的。.HEIC文件包含一个8x6的图像网格(图block),如果将它们放在一起,您将获得完整的图像。简单地

c# - IDE 条件 block 突出显示

设置:假设我有一个相当大的程序,并且正在使用#defines和各种包含/排除各种代码片段的方法。即假设我有一段这样的代码example_file.c:include#ifdefTHISdosomethingreallycoolhere#ifdefTHATdosomethingevencooler#endif#endif定义文件.c:#defineTHATTRUE#defineTHISFALSE现在我不知道这两个语句是否会被包含或使用,除非我查看定义。上面是一个简单的示例,但假设您有50个ifdef,并且它们以不同的方式嵌套,要追踪这50个值中的每一个值是什么有点麻烦。问题:是否存在一个

c++ - GNU 编译器 vs. Visual Studio 在数组上分配 w/Length Constant w/in a Scope

我知道如果你在c/c++中设置一个动态值,你不能在括号内使用该值来分配一个数组(这会使它成为所谓的可变长度数组(VLA),其中currentC++standard不支持)...即见:C++:VariableLengthArrayhttp://en.wikipedia.org/wiki/Variable-length_array我不太明白(而且我在这里没有看到确切地问到的)是为什么GNUc/c++编译器(gcc、g++)没问题使用基于整数值的动态分配(据我所知),只要该值是数组分配范围内的常量,但VisualStudio不支持这一点并且将拒绝编译代码,吐出错误。例如在g++中voidFo

c++ - boost::scoped_lock 不适用于局部静态变量?

我制作了以下示例程序来使用boost线程:#pragmaonce#include"boost\thread\mutex.hpp"#includeclassThreadWorker{public:ThreadWorker(){}virtual~ThreadWorker(){}staticvoidFirstCount(intthreadId){boost::mutex::scoped_lock(mutex_);staticinti=0;for(i=1;i主类://ThreadTest.cpp#include"stdafx.h"#include"boost\thread\thread.hpp

c++ - "Function not declared in this scope"编译openCV代码出错

我正在尝试编写一些使用openCV函数的代码。我从文档中提供的一些示例代码开始:#include#include#includeusingnamespacecv;usingnamespacestd;intmain(intargc,char**argv){if(argc!=2){cout当我尝试在Eclipse-CDT中构建它时,我得到了这个:****BuildofconfigurationDebugforprojectopenCV1****makeallBuildingtarget:openCV1Invoking:CrossG++Linkerg++-L/usr/local/lib-o"

c++ - 在 C++0x 中模拟 finally block

灵感来自theothertopic,我写了这段代码来模拟finallyblock:#include#includestructbase{virtual~base(){}};templatestructexec:base{TLambdalambda;exec(TLambdal):lambda(l){}~exec(){lambda();}};classlambda{base*pbase;public:templatelambda(TLambdal):pbase(newexec(l)){}~lambda(){deletepbase;}};classA{inta;public:voidstar

c++ - 用魔数(Magic Number)初始化一 block 内存的简洁方法

我所指的几个例子:typedefstructSOME_STRUCT{unsignedintx1;unsignedintx2;unsignedintx3;unsignedintx4;//WhatIexpectedwouldwork,butdoesn't;the2ndparametergets//turnedintoan8-bitquantityatsomepointwithinmemsetSOME_STRUCT(){memset(this,0xFEEDFACE,sizeof(*this));}//Somethingthatworked,butseemshokey/hackishSOME_

c++ - 为什么这个案例 block 不执行?

几周前我才开始尝试C++。在尝试C++之前,我对Java有了相当不错的掌握。很多人告诉我,它们在语法意义上非常相似。在底部有一个switch语句来启动战斗场景。每当我选择战斗选项时,它只会关闭程序。这是我的代码:#include"stdafx.h"#include#include//Forrand()#include#include#include//transform()#include//toupper(),tolower()#include//ptr_fun()#include//PUTS***BELOWTHISPOINT//___________________________

c++ - 关于 RAII,C++ `try`/`catch` block 是否与其他 block 相同?

好吧,如果我使用RAII习惯用法来管理某些上下文属性*,如果我在tryblock的开头直接使用它,它会像我预期的那样工作吗?换句话说,如果我有这个:structraii{raii(){std::cout……我成功地使用了它:{raiido_the_raii_thing;stuff_expecting_raii_context();/*…*/}...如果我这样做,RAII实例会以同样的方式工作吗:try{raiido_the_raii_thing;stuff_expecting_raii_context_that_might_throw();/*…*/}catch(std::except

c++ - (C++) 错误 : 'invalid_argument' was not declared in this scope

我正在使用EclipseC/C++和MinGW编译器。我已将标志-std=c++11添加到项目属性中C/C++Build下的MiscellaneousGCCCCompilerSettings中。我知道这可能是一件简单的事情,但我无法解决此错误。Date.h#includeusingnamespacestd;classDate{public:Date(intm=1,intd=1,inty=1900);voidsetDate(int,int,int);private:intmonth;intday;intyear;staticconstintdays[];};日期.cpp#include#