草庐IT

using-declarator

全部标签

Android API 级别 < 19 和 "try can use automatic resource management"警告

我有这段代码privatevoidcopyFile(Filesrc,Filedst)throwsIOException{FileChannelinChannel=newFileInputStream(src).getChannel();FileChanneloutChannel=newFileOutputStream(dst).getChannel();try{inChannel.transferTo(0,inChannel.size(),outChannel);}finally{if(inChannel!=null){inChannel.close();}outChannel.clo

c++ - 新项目 : I am having troubles picking a language to use

我正在开始我的第一家独立营利企业。我很难决定使用哪种语言。我想用Perl编写我的应用程序,但我认为编译起来不够简单。如果我不用Perl编写,我会用C++编写。该应用程序将具有许多功能,包括wxwidgets接口(interface),处理SDL,定时器,一些线程,和音频处理。该程序本身会有些复杂,但不会特别大。所以我的问题是:PAR、Perl2exe或等效程序能否编译出基本测试用例以外的内容?撇开速度和编译不谈,为什么我应该使用C++而不是Perl?编辑:我的一些项目规范。多平台。我预计50%或更多的用户拥有mac,其余大部分是Windows用户。如果可能的话,我也想支持Linux,因

c++ - 具有从属限定标识的类成员 using-declaration 是否应该是从属名称?

C++11标准草案N3337在[namespace.udecl]中声明Ausing-declarationintroducesanameintothedeclarativeregioninwhichtheusing-declarationappears.Everyusing-declarationisadeclarationandamember-declarationandsocanbeusedinaclassdefinition.Inausing-declarationusedasamember-declaration,thenested-name-specifiershallnam

c++ - boost .MultiIndex : searching elements using multiple fields

我正在使用Boostmulti_index容器根据2个整数键K1和K2存储对象。我可以轻松地检索满足“K1==X”的所有元素的迭代器,例如,通过获取第一个索引并使用find()函数(K2的同上和值Y),但我正在寻找一种方法在满足K1==X和K2==Y的所有元素上获得一个迭代器。一个明显的解决方案是在满足K1==X的所有元素上获得一个迭代器,然后使用谓词K2==Y构建一个boost::filter_iterator,但是有没有办法只从Boost.MultiIndex做到这一点(也许更有效)?谢谢马修 最佳答案 您可以使用boost::

c++ - "error: ' avcodec_open ' was not declared in this scope"尝试编译 untrunc

我有一个断电的摄像机录制的视频。因此,它制作的带有H.264编解码器的MP4文件已损坏。我想在Ubuntu14.04.1中修复这个文件。我见过的一种方法suggested就是用untrunc.我正在尝试编译它,但遇到了一个我不知道如何解决的错误。到目前为止我所做的如下:sudoapt-getinstalllibavformat-devlibavcodec-devlibavutil-devgitclonehttps://github.com/ponchio/untrunc.gitcduntrunc/g++-ountruncfile.cppmain.cpptrack.cppatom.cpp

c++ - fatal error C1017 : invalid integer constant expression when using "#if (false)"

下面的代码可以在Linux下运行,但对于MSVS会出错#if(false)....#endif错误是:fatalerrorC1017:invalidintegerconstantexpression我在Microsoft的网站上找到了这份报告:http://msdn.microsoft.com/en-us/library/h5sh3k99.aspx虽然那里描述的信息与我的情况相比略有不同,因为我没有使用“#define”所以我的问题是:有没有什么方法可以让它在不更改代码的情况下为MSVC工作?如果必须更新代码,这种情况的最佳解决方案是什么? 最佳答案

c++ - std::bind std::shared_ptr 参数不会增加 use_count

以下代码:#include#include#includestructFoo{Foo():m_p(std::make_shared()){}Foo(constFoo&foo){printf("copy\n");}std::shared_ptrm_p;};voidfunc(Foofoo){}intmain(){Foofoo;std::functionf=std::bind(func,foo);printf("usecount:%ld\n",foo.m_p.use_count());f();}得到结果:copycopyusecount:1copy由于复制了Foo,所以我认为m_p的use_

c++ - gcc used 属性的用例是什么?

#include//xyzwillbeemittedwith-flto(orifitisstatic)evenwhen//thefunctionisunused__attribute__((__used__))voidxyz(){printf("HelloWorld!\n");}intmain(){return0;}我需要这个做什么?除了直接调用函数之外,还有什么方法可以到达xyz吗,比如一些dlsym()之类的魔法? 最佳答案 Attributeused在您想要强制编译器发出符号的情况下很有用,而通常情况下它可能会被省略。作为GC

c++ - 在 xcode 中包含 cmath 时出现错误 : '::acos' has not been declared, 等

在尝试构建包含的小型简单项目时出现以下错误在Xcode中:cmath:'*'hasnotbeendeclared'::acos'hasnotbeendeclaredInfileincludedfrom/Xcode4/Projects/libraryLAFMath/Classes/libraryLAFMath.cpInfileincludedfrom/Xcode4/Projects/libraryLAFMath/Classes/libraryLAFMath.h'::acos'hasnotbeendeclaredin/Xcode4/Platforms/iPhoneSimulator.pla

c++ - "unspecialized class template can' t be used as a template argument”是什么意思?

我有一个名为AbstractRManagers的类,我想从一个单例模板类Singleton继承,但是abstractRmanager需要成为一个模板类我遇到了一些没有用的奇怪错误代码,我已经尝试查找它但是没运气。templateclassAbstractRManagers:publicSingleton{errorC3203:'AbstractRManagers':unspecializedclasstemplatecan'tbeusedasatemplateargumentfortemplateparameter'Type',expectedarealtype