草庐IT

name-binding

全部标签

c++ - 出于对象替换的目的,对象的 "name"究竟是由什么构成的?

根据[basic.life]/8,If,afterthelifetimeofanobjecthasendedandbeforethestoragewhichtheobjectoccupiedisreusedorreleased,anewobjectiscreatedatthestoragelocationwhichtheoriginalobjectoccupied,apointerthatpointedtotheoriginalobject,areferencethatreferredtotheoriginalobject,orthenameoftheoriginalobjectwil

由于无法解析重载函数,C++ 绑定(bind)失败

这个问题在这里已经有了答案:std::bindoverloadresolution(3个答案)关闭3年前。voidprintVector(vector&data){for(autoi:data){coutdata{0,1,2,3,4,5,6,7,8,9};vectorresult;result.resize(data.size());transform(data.begin(),data.end(),result,bind(std::pow,_1,2));return0;}抛出的错误是:stlalgo.cpp:22:61:error:nomatchingfunctionforcallt

c++ - tr1::mem_fn 和 tr1::bind:常量正确性和重载

以下代码片段有什么问题?#include#include#includeusingnamespacestd::tr1::placeholders;structabc{typedefvoidresult_type;voidhello(int){std::cout尝试用g++-4.3编译它,似乎cv-qualifier重载函数混淆了tr1::mem_fn和tr1::bind并出现以下错误:nomatchingfunctionforcallto‘bind(,...下面的代码片段编译但似乎破坏了const-correctness:structabc{typedefvoidresult_type

c++ - 有没有办法使用 boost::program_options::parse_config_file 在 INI 文件中包含多个 "name=value"行?

我希望能够使用boost::program_options在INI文件中指定多个name=value行。有点像[list.names]name=valuename=value2name=value3有没有办法用boost::program_options实现这个?如果我尝试它,我会得到一个多次出现的错误如果没有,还有哪些其他库可用? 最佳答案 指定字段的值为std::vector在options_description:namespacepo=boost::program_options;po::options_descriptio

c++ - 从模板中绑定(bind)模板函数

接续thisquestion.我正在尝试绑定(bind)一个给定的函数,该函数返回除void之外的其他内容,以便稍后能够简单地调用f()。但是,以下代码无法在GCC4.4上编译。它在VS2010上编译,但生成的程序崩溃。templatevoid_hideRet(std::functionfunc,RetType*ret){*ret=func();}templatestd::functionregisterFunc(FuncTypefunc,RetType*ret,ParamTypeparam){autof=std::bind(func,std::forward(param));retu

Bean named ‘ddlApplicationRunner‘ is expected to be of type ‘org.springframework.boot. Runner‘ 。。。

springboot整合mybatisplus时遇见报错错误信息:Beannamed'ddlApplicationRunner'isexpectedtobeoftype'org.springframework.boot.Runner'butwasactuallyoftype'org.springframework.beans.factory.support.NullBean'atorg.springframework.beans.factory.support.AbstractBeanFactory.adaptBeanInstance(AbstractBeanFactory.java:410)

c++ - 无法识别的类型 - 'Error: Variable "[var-name ]"is not a type name'

作为项目的一部分,我正在创建一个处理物理的类。我们被告知要使用一个处理任意行为的类。我创建了一个类,它将根据提供给它的模块更新内部状态(代码如下)。但是,表示内部状态的结构PhysicsData除了它自己的文件外,在任何地方都无法识别。任何人都可以解释一下吗?(对于大量信息的转储,我们深表歉意,但是问题所在的对象和问题所在的位置之间的差距非常大,减少额外的细节也会删除可能有用的上下文)这里是有问题的结构:#pragmaonce//Thisfile"PhysicsBehaviourBase.h"#include#includestructPhysicsData{public:D3DXVE

c++ - 使用带有绑定(bind)的 boost 字符串算法谓词

编译这个例子#include#include#include#include#includeusingnamespacestd;intmain(int,char**){vectortest;test.push_back("xtest2");test.push_back("test3");ostream_iteratorout_it(cout,"\n");remove_copy_if(test.begin(),test.end(),out_it,boost::bind(boost::algorithm::starts_with,_1,"x"));}因错误而失败nomatchingfunc

c++ - "Name The Template Parameter"奇定义

template//whyisboolhere,classbooltype=bool.Aretheyequivalent?structif_{typedeftypenamettype;};templatestructif_//whatdoesthemean?{typedeftypenameutype;};代码来自一篇名为“命名模板参数”的文章。我无法理解both结构的定义。 最佳答案 编辑:首先移动最重要的部分:if_::type;//thisisintif_::type;//thisisdouble这很方便地定义了一个可以在编译时

c++ - 没有模板重新绑定(bind)的 typedef 模板。作为模板类参数的模板使用

我想做这样的事情:templateclassBaseSubscriber{};templateclassBasePublisher{//notworking:invaliduseoftemplate-name'BaseSubscriber'withoutanargumentlisttypedefBaseSubscriberSubscriberType;//compilingtypedefBaseSubscriberSubscriberTypeT;};templateclassSubscriber,classData>classClassA:publicSubscriber{};temp