jjzjj

apply-able

全部标签

c++ - CMake "clang++ is not able compile a simple test program"(软呢帽 20)

所以我尝试安装clang+cmake来编译一个简单的C++程序,但出现以下错误:--TheCcompileridentificationisGNU4.8.3--TheCXXcompileridentificationisClang3.5.0--CheckforworkingCcompiler:/usr/bin/cc--CheckforworkingCcompiler:/usr/bin/cc--works--DetectingCcompilerABIinfo--DetectingCcompilerABIinfo-done--CheckforworkingCXXcompiler:/usr/

c++ - 如何检查类型是否为 mpl::apply-able?

如果我有类型,T,看起来像Foo,我能做到mpl::apply::type得到Foo.但是如果T是一个完整的类型,比如Foo,然后mpl::apply::type不会编译。我想编写一个元函数,如果可能的话将应用一个类型,否则返回该类型。所以像这样:templatestructmaybe_apply:eval_if_c,mpl::identity>{};我可以在???s中放什么,这样它就能达到我想要的效果? 最佳答案 免责声明:我远不是MPL方面的专家,所以我不能保证这是解决这个问题的最佳方法(或者即使它是正确的,它至少看起来是有效的

c++ - 修改后的 std::invoke/std::apply,将可调用对象作为 void* - 可能吗?

在C++17中我们有std::invoke:templatestd::result_of_tinvoke(F&&f,ArgTypes&&...args);(并且在C++11中已经有std::experimental::apply,它是相似的,但有一个元组)。现在,我要实现:templateTinvoke(void*f,ArgTypes&&...args);与std::invoke的不同之处在于f是通过void指针传递的,并且其类型没有模板参数。然而,类型可以被人类读者推断出来,前提是f是一个指向普通独立函数的指针,我可以这样做:templateTmy_invoke(void*f,Arg

c++ - Boost 变体 apply_visitor 编译错误

boost::variant和boost::apply_visitor的简单示例代码:#includestructExprFalse;structExprTrue;structExprMaybe;typedefboost::variantExpression;structExprFalse{};structExprTrue{};structExprMaybe{};structPrinter:publicboost::static_visitor{public:Printer(std::ostream&os):m_os(os){}voidoperator()(ExprFalseconst

c++ - "Why switch statement cannot be applied on strings?"的答案是否仍然正确,即使使用 C++11/14?

我遇到了这个问题:Whyswitchstatementcannotbeappliedonstrings?并想知道答案是否:Thereasonwhyhastodowiththetypesystem.C/C++doesn'treallysupportstringsasatype.Itdoessupporttheideaofaconstantchararraybutitdoesn'treallyfullyunderstandthenotionofastring.仍然适用,即使在C++11/14中使用std:string。是否有多个elseif(...)的替代方案?

c++ - 警告 C4180 : qualifier applied to function type has no meaning; ignored

我已经设置了编译器/Za选项来禁用语言扩展,以便编译器严格使用标准ISOC++。这是我收到以下警告的示例接口(interface)类warningC4180:qualifierappliedtofunctiontypehasnomeaning;ignored这是关于函数返回类型中的const限定符,如果我删除const,警告就会消失,但我不想这样做,我想重新启用lanqage扩展。我的问题是:这个警告合理吗?如果不是,那么我将使用pragma禁用警告,但在此之前我想确保此警告是“误报”因为下面的类是正确的ANSIISOC++不是吗?所以警告应该被禁用?classIBet{public:

c++ - 使用 std::apply 遍历元组元素

我想实现一种将函数应用于给定元组的每个元素的方法,我想出了一个解决方案,在以下示例中进行了演示。intmain(){std::apply([](auto&&...xs){[](...){}(([](auto&&x){std::cout(xs)),false)...);},std::make_tuple(1,2.f,3.0));}这似乎工作正常,除了元组元素似乎以倒序处理,导致以下输出:321谁能告诉我为什么? 最佳答案 内部空lambda参数的顺序[](...){}评估未指定(即使在paperonevaluationorder之后)

c++ - 为什么 std::apply 会因泛型函数而失败?

取自cppreference,为什么调用std::apply(add_generic,...)编译失败?有办法解决吗?#include#includeintadd(intfirst,intsecond){returnfirst+second;}templateTadd_generic(Tfirst,Tsecond){returnfirst+second;}intmain(){std::cout它fails有错误:[x86-64gcc7(snapshot)]error:nomatchingfunctionforcallto'apply(,std::tuple)'[x86-64gcc7(s

c++ - 如何从 dispatch_apply (GCD) 循环写入数组?

我编写了代码来使用Runge-Kutta方法计算大量耦合主方程的动力学。代码包含很多for循环,其中每个步骤都是独立的。我打算使用GrandCentralDispatch来加速程序。我的尝试基于我在http://www.macresearch.org/cocoa-scientists-xxxi-all-aboard-grand-central找到的示例.我的代码和macresearch上的示例都不能在我的机器上编译(MacOSX10.6.8Xcode4.0.2)。所以这是我的代码:...doublevalues[SpaceSize],k1[SpaceSize];for(intt=1;t

ios - 福昕IOSRDK : not able to click on Hyperlink

我正在使用FoxitRDK框架在我的应用程序中打开pdf文档。在演示中,除一件事外一切正常:我无法单击超链接。我已经查看了SDK文档和框架内的类,但无法找到解决方案。文档链接如下:http://www.foxitsdk.com/docs/mobile-pdf-sdk/developer_guide_ios.pdf这是我的代码NSString*pdfPath=[[NSBundlemainBundle]pathForResource:@"getting_started_ios1"ofType:@"pdf"];//InitializeaPDFDocobjectwiththepathtothe