您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Clone函数代码示例

51自学网 2021-06-01 20:11:32
  C++
这篇教程C++ Clone函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Clone函数的典型用法代码示例。如果您正苦于以下问题:C++ Clone函数的具体用法?C++ Clone怎么用?C++ Clone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Clone函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FiniteSitesDFE

 FiniteSitesDFE(Random & random, DFE dfe, int L): dfe(dfe), U0(dfe.U0), L(L), draw_label(0,L-1), fitness_effects(L,1), sign_flips(L,false){      for(auto & W : fitness_effects){         W = dfe.get_fitness_effect(random, Clone());     } };
开发者ID:benjaminhgood,项目名称:ltee_inference,代码行数:6,


示例2: RouteTrackingMain

// Routing table tracking mainvoid RouteTrackingMain(SESSION *s){	ROUTE_TRACKING *t;	UINT64 now;	ROUTE_TABLE *table;	ROUTE_ENTRY *rs;	bool changed = false;	bool check = false;	bool any_modified = false;	// Validate arguments	if (s == NULL)	{		return;	}	if (s->ClientModeAndUseVLan == false)	{		return;	}	// Get the state	t = ((VLAN *)s->PacketAdapter->Param)->RouteState;	if (t == NULL)	{		return;	}	// Current time	PROBE_STR("RouteTrackingMain 1");	now = Tick64();	if (t->RouteChange != NULL)	{		if (t->NextRouteChangeCheckTime == 0 ||			t->NextRouteChangeCheckTime <= now)		{			t->NextRouteChangeCheckTime = now + 1000ULL;			check = IsRouteChanged(t->RouteChange);			if (check)			{				Debug("*** Routing Table Changed ***/n");				t->NextTrackingTime = 0;			}		}	}	if (t->NextTrackingTime != 0 && t->NextTrackingTime > now)	{		if (s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->NatT_IP_Changed)		{			// Check always if the IP address of the NAT-T server has changed		}		else		{			PROBE_STR("RouteTrackingMain 2");			return;		}	}	PROBE_STR("RouteTrackingMain 3");	if (s->UseUdpAcceleration && s->UdpAccel != NULL)	{		IP nat_t_ip;		s->UdpAccel->NatT_IP_Changed = false;		Zero(&nat_t_ip, sizeof(nat_t_ip));		Lock(s->UdpAccel->NatT_Lock);		{			Copy(&nat_t_ip, &s->UdpAccel->NatT_IP, sizeof(IP));		}		Unlock(s->UdpAccel->NatT_Lock);		// Add a route to the NAT-T server		if (IsZeroIp(&nat_t_ip) == false)		{			if (t->RouteToNatTServer == NULL)			{				if (t->RouteToEight != NULL)				{					ROUTE_ENTRY *e = Clone(t->RouteToEight, sizeof(ROUTE_ENTRY));					char ip_str[64];					char ip_str2[64];					Copy(&e->DestIP, &nat_t_ip, sizeof(IP));					e->Metric = e->OldIfMetric;					IPToStr(ip_str, sizeof(ip_str), &e->DestIP);					IPToStr(ip_str2, sizeof(ip_str2), &e->GatewayIP);					t->RouteToNatTServer = e;					if (AddRouteEntry(t->RouteToNatTServer))					{						Debug("Adding Static Route to %s via %s metric %u: ok./n", ip_str, ip_str2, e->Metric);					}					else					{//.........这里部分代码省略.........
开发者ID:m-a-n-a-v,项目名称:SoftEtherVPN_Stable,代码行数:101,


示例3: Clone

	const CImageAttribute& CImageAttribute::operator=(const CImageAttribute& image)	{		Clone(image);		return *this;	}
开发者ID:baijiazhao,项目名称:DuiLib_Redrain,代码行数:5,


示例4: raise_warning

Object c_Closure::t_bindto(const Variant& newthis, const Variant& scope) {  if (RuntimeOption::RepoAuthoritative &&      RuntimeOption::EvalAllowScopeBinding) {    raise_warning("Closure binding is not supported in RepoAuthoritative mode");    return Object{};  }  auto const cls = getVMClass();  auto const invoke = cls->getCachedInvoke();  ObjectData* od = nullptr;  if (newthis.isObject()) {    if (invoke->isStatic()) {      raise_warning("Cannot bind an instance to a static closure");    } else {      od = newthis.getObjectData();    }  } else if (!newthis.isNull()) {    raise_warning("Closure::bindto() expects parameter 1 to be object");    return Object{};  }  auto const curscope = invoke->cls();  auto newscope = curscope;  if (scope.isObject()) {    newscope = scope.getObjectData()->getVMClass();  } else if (scope.isString()) {    auto const className = scope.getStringData();    if (!className->equal(s_static.get())) {      newscope = Unit::loadClass(className);      if (!newscope) {        raise_warning("Class '%s' not found", className->data());        return Object{};      }    }  } else if (scope.isNull()) {    newscope = nullptr;  } else {    raise_warning("Closure::bindto() expects parameter 2 "                  "to be string or object");    return Object{};  }  if (od && !newscope) {    // Bound closures should be scoped.  If no scope is specified, scope it to    // the Closure class.    newscope = static_cast<Class*>(c_Closure::classof());  }  bool thisNotOfCtx = od && !od->getVMClass()->classof(newscope);  if (!RuntimeOption::EvalAllowScopeBinding) {    if (newscope != curscope) {      raise_warning("Re-binding closure scopes is disabled");      return Object{};    }    if (thisNotOfCtx) {      raise_warning("Binding to objects not subclassed from closure "                    "context is disabled");      return Object{};    }  }  c_Closure* clone = Clone(this);  clone->setClass(nullptr);  Attr curattrs = invoke->attrs();  Attr newattrs = static_cast<Attr>(curattrs & ~AttrHasForeignThis);  if (od) {    od->incRefCount();    clone->setThis(od);    if (thisNotOfCtx) {      // If the bound $this is not a subclass of the context class, then we      // have to pessimize translation.      newattrs |= AttrHasForeignThis;    }  } else if (newscope) {    // If we attach a scope to a function with no bound $this we need to make    // the function static.    newattrs |= AttrStatic;    clone->setClass(newscope);  }  // If we are changing either the scope or the attributes of the closure, we  // need to re-scope its Closure subclass.  if (newscope != curscope || newattrs != curattrs) {    assert(newattrs != AttrNone);    auto newcls = cls->rescope(newscope, newattrs);    clone->setVMClass(newcls);  }  return Object(clone);}
开发者ID:nadanomics,项目名称:hhvm,代码行数:99,


示例5: Clone

 /**  * This method creates a copy of the current Message. It allocates the new one  * from the same Message Poll as the original Message and copies a full payload.  *  * @returns A pointer to the message or NULL if insufficient message buffers are available.  */ Message *Clone(void) const { return Clone(GetLength()); };
开发者ID:nandojve,项目名称:openthread,代码行数:7,


示例6: Clone

Stack::Stack(const Stack& obj){	stack = nullptr;	Clone(obj);}
开发者ID:ArtyomLinnik,项目名称:Study,代码行数:5,


示例7: Clone

void CSL_EfTInt::Apply(MSL_ExprEnv& aEnv, vector<string>& aArgs, vector<string>::iterator& aArgr, CSL_ExprBase& aArg, CSL_ExprBase*& aRes, const string& aReqType){    aRes = Clone();    aRes->AcceptArg();    aRes->SetData(aArg.Data());}
开发者ID:yborisovstc,项目名称:fapws,代码行数:6,


示例8: skiplightreweightdraw

void skiplightreweightdraw(){	float beta  = 0.045;//110/50 = 0.28;//FEXGSP = 0.4	float gamma = 1.182;//110/50 = 1.24;//FEXGSP = 0.4	auto f= new TFile("skiplightreweight.root");	auto h12all = (TH1F *)f->Get("h12all");	auto h12fcr = (TH1F *)f->Get("h12fcr");	auto h12fex = (TH1F *)f->Get("h12fex");	auto h12gsp = (TH1F *)f->Get("h12gsp");	auto hSLall = (TH1F *)f->Get("hSLall");	auto hSLfcr = (TH1F *)f->Get("hSLfcr");	auto hSLfex = (TH1F *)f->Get("hSLfex");	auto hSLgsp = (TH1F *)f->Get("hSLgsp");	auto h12data = (TH1F *)f->Get("h12data");	auto hSLdata = (TH1F *)f->Get("hSLdata");	auto h12dphiall = (TH1F *)f->Get("h12dphiall");	auto h12dphifcr = (TH1F *)f->Get("h12dphifcr");	auto h12dphifex = (TH1F *)f->Get("h12dphifex");	auto h12dphigsp = (TH1F *)f->Get("h12dphigsp");	auto hSLdphiall = (TH1F *)f->Get("hSLdphiall");	auto hSLdphifcr = (TH1F *)f->Get("hSLdphifcr");	auto hSLdphifex = (TH1F *)f->Get("hSLdphifex");	auto hSLdphigsp = (TH1F *)f->Get("hSLdphigsp");	auto h12dphidata = (TH1F *)f->Get("h12dphidata");	auto hSLdphidata = (TH1F *)f->Get("hSLdphidata");	auto h12dphiNSall = (TH1F *)f->Get("h12dphiNSall");	auto h12dphiNSfcr = (TH1F *)f->Get("h12dphiNSfcr");	auto h12dphiNSfex = (TH1F *)f->Get("h12dphiNSfex");	auto h12dphiNSgsp = (TH1F *)f->Get("h12dphiNSgsp");	auto hSLdphiNSall = (TH1F *)f->Get("hSLdphiNSall");	auto hSLdphiNSfcr = (TH1F *)f->Get("hSLdphiNSfcr");	auto hSLdphiNSfex = (TH1F *)f->Get("hSLdphiNSfex");	auto hSLdphiNSgsp = (TH1F *)f->Get("hSLdphiNSgsp");	auto h12dphiNSdata = (TH1F *)f->Get("h12dphiNSdata");	auto hSLdphiNSdata = (TH1F *)f->Get("hSLdphiNSdata");	auto h12ordall = (TH1F *)f->Get("h12ordall");	auto h12ordfcr = (TH1F *)f->Get("h12ordfcr");	auto h12ordfex = (TH1F *)f->Get("h12ordfex");	auto h12ordgsp = (TH1F *)f->Get("h12ordgsp");	auto hSLordall = (TH1F *)f->Get("hSLordall");	auto hSLordfcr = (TH1F *)f->Get("hSLordfcr");	auto hSLordfex = (TH1F *)f->Get("hSLordfex");	auto hSLordgsp = (TH1F *)f->Get("hSLordgsp");	auto h12orddata = (TH1F *)f->Get("h12orddata");	auto hSLorddata = (TH1F *)f->Get("hSLorddata");	auto h12reweighted = (TH1F *)h12all->Clone("h12reweighted");	auto hSLreweighted = (TH1F *)hSLall->Clone("hSLreweighted");	h12reweighted->Reset();h12reweighted->SetTitle("h12reweighted");	hSLreweighted->Reset();hSLreweighted->SetTitle("hSLreweighted");	auto h12dphiNSreweighted = (TH1F *)h12dphiNSall->Clone("h12dphiNSreweighted");	auto hSLdphiNSreweighted = (TH1F *)hSLdphiNSall->Clone("hSLdphiNSreweighted");	h12dphiNSreweighted->Reset();h12dphiNSreweighted->SetTitle("h12dphiNSreweighted");	hSLdphiNSreweighted->Reset();hSLdphiNSreweighted->SetTitle("hSLdphiNSreweighted");	auto h12dphireweighted = (TH1F *)h12dphiall->Clone("h12dphireweighted");	auto hSLdphireweighted = (TH1F *)hSLdphiall->Clone("hSLdphireweighted");	h12dphireweighted->Reset();h12dphireweighted->SetTitle("h12dphireweighted");	hSLdphireweighted->Reset();hSLdphireweighted->SetTitle("hSLdphireweighted");	auto h12ordreweighted = (TH1F *)h12ordall->Clone("h12ordreweighted");	auto hSLordreweighted = (TH1F *)hSLordall->Clone("hSLordreweighted");	h12ordreweighted->Reset();h12ordreweighted->SetTitle("h12ordreweighted");	hSLordreweighted->Reset();hSLordreweighted->SetTitle("hSLordreweighted");	h12reweighted->Add(h12fex,h12gsp,beta,gamma);	h12reweighted->Add(h12fcr);	hSLreweighted->Add(hSLfex,hSLgsp,beta,gamma);	hSLreweighted->Add(hSLfcr);	h12dphireweighted->Add(h12dphifex,h12dphigsp,beta,gamma);	h12dphireweighted->Add(h12dphifcr);	hSLdphireweighted->Add(hSLdphifex,hSLdphigsp,beta,gamma);	hSLdphireweighted->Add(hSLdphifcr);	h12dphiNSreweighted->Add(h12dphiNSfex,h12dphiNSgsp,beta,gamma);	h12dphiNSreweighted->Add(h12dphiNSfcr);	hSLdphiNSreweighted->Add(hSLdphiNSfex,hSLdphiNSgsp,beta,gamma);	hSLdphiNSreweighted->Add(hSLdphiNSfcr);	h12ordreweighted->Add(h12ordfex,h12ordgsp,beta,gamma);	h12ordreweighted->Add(h12ordfcr);	hSLordreweighted->Add(hSLordfex,hSLordgsp,beta,gamma);	hSLordreweighted->Add(hSLordfcr);	Normalize({h12data,h12all,hSLdata,hSLall,//.........这里部分代码省略.........
开发者ID:bjet2015,项目名称:sanitychecks,代码行数:101,


示例9: checkclosure

//.........这里部分代码省略.........  auto fmcPb = config.getfile_djt("mcPbbfa");  Fill(fmcPb,{"pthat","weight","jtpt1","refpt1","bProdCode","jtptSL","refptSL","dphiSL1","refparton_flavorForB1","subidSL","bin","pairCodeSL1","discr_csvV1_1","jteta1","jtetaSL"},[&] (dict d) {      if (d["pthat"]<pthatcut) return;            if (d["jtpt1"]>pt1cut && d["refpt1"]>50 && abs(d["refparton_flavorForB1"])==5 && d["jtptSL"]>pt2cut) {        int bin = getbinindex(d["bin"]);                float xj = d["jtptSL"]/d["jtpt1"];        float w = weight1SLPbPb(d);        if (AwaySide(d)) hasd[bin]->Fill(xj, w);        if (AwaySide(d) && IsSignal(d)) hsig[bin]->Fill(xj,w);        if (NearSide(d)) hbkg[bin]->Fill(xj,w);        if (NearSide(d) && !IsSignal(d)) hhyj[bin]->Fill(xj,w);      }              });  for (int i=0;i<Nbins;i++) {    hsub[i]->Add(hasd[i],hbkg[i],1,-1*bkgfractionInNearSide[i]);    hsbn[i]->Add(hasd[i],hbkg[i],1,-1);    hshj[i]->Add(hasd[i],hhyj[i],1,-1);  }//  for (int i=0;i<Nbins;i++) //    hincsub[i]->Add(hincasd[i],hincbkg[i],1,-1);  seth(bins);//Nbins,0,100);  auto hcentrSubSIG = geth("hcentrSubSIG","Signal;bin;#LTx_{J}#GT");  auto hcentrSubASD = geth("hcentrSubASD","Unsubtracted;bin;#LTx_{J}#GT");  auto hcentrSubBKS = geth("hcentrSubBKS","Subtracted w/o bkg scaling;bin;#LTx_{J}#GT");  auto hcentrSubCLS = geth("hcentrSubCLS","Subtracted with bkg scaling;bin;#LTx_{J}#GT");  auto hcentrSubHJS = geth("hcentrSubHJS","Subtracted Hydjet;bin;#LTx_{J}#GT");  plotlegendpos = BottomRight;  for (int i=0;i<Nbins;i++) {    hcentrSubSIG->SetBinContent(i+1,hsig[i]->GetMean());hcentrSubSIG->SetBinError(i+1,hsig[i]->GetMeanError());    hcentrSubASD->SetBinContent(i+1,hasd[i]->GetMean());hcentrSubASD->SetBinError(i+1,hasd[i]->GetMeanError());    hcentrSubBKS->SetBinContent(i+1,hsbn[i]->GetMean());hcentrSubBKS->SetBinError(i+1,hsbn[i]->GetMeanError());    hcentrSubCLS->SetBinContent(i+1,hsub[i]->GetMean());hcentrSubCLS->SetBinError(i+1,hsub[i]->GetMeanError());    hcentrSubHJS->SetBinContent(i+1,hshj[i]->GetMean());hcentrSubHJS->SetBinError(i+1,hshj[i]->GetMeanError());    Draw({hsig[i],hsub[i],hshj[i]});  }  plotymin = 0.55;//0.4;  plotymax = 0.7;//0.8;  plotlegendpos = BottomRight;  aktstring = "";  plotputmean = false;  //hcentrSubHJS - hydjet only subtraction  // SetMC({hcentrSubSIG, hcentrSubBKS, hcentrSubASD});  // SetData({hcentrSubCLS});  hcentrSubSIG->SetMarkerStyle(kOpenSquare);  hcentrSubBKS->SetMarkerStyle(kOpenSquare);  hcentrSubASD->SetMarkerStyle(kOpenSquare);  hcentrSubCLS->SetMarkerStyle(kFullCircle);  hcentrSubSIG->SetMarkerColor(TColor::GetColorDark(2)); hcentrSubSIG->SetLineColor(TColor::GetColorDark(2));  hcentrSubBKS->SetMarkerColor(TColor::GetColorDark(3)); hcentrSubBKS->SetLineColor(TColor::GetColorDark(3));  hcentrSubASD->SetMarkerColor(TColor::GetColorDark(4)); hcentrSubASD->SetLineColor(TColor::GetColorDark(4));  hcentrSubCLS->SetMarkerColor(TColor::GetColorDark(3)); hcentrSubCLS->SetLineColor(TColor::GetColorDark(3));  plotoverwritecolors = false;  plotlegenddx = -0.15;  Draw({hcentrSubSIG,hcentrSubASD, hcentrSubBKS, hcentrSubCLS});  auto syst = (TH1F *)hcentrSubSIG->Clone("syst");  syst->Add(hcentrSubCLS,-1);  map<TString,float> m;  for (unsigned i=0;i<bins.size()-1;i++) {    float misclosure = syst->GetBinContent(i+1);    float err = hcentrSubCLS->GetBinError(i+1);    m[Form("closure%d%d",(int)bins[i],(int)bins[i+1])]=sqrt(misclosure*misclosure+err*err);  }  WriteToFile(plotfoldername+"/hydjetclosuresyst.root",m);}
开发者ID:bjet2015,项目名称:dibjets,代码行数:101,


示例10: _L8

    pProperties->SetPropertyL(_L8("PropertyName4"), _L8("PropertyValue4"),                              MSenLayeredProperties::ESenProviderSessionLayer);    pProperties->SetPropertyL(_L8("PropertyName5"), _L8("PropertyValue5"),                              MSenLayeredProperties::ESenConsumerSessionLayer);    pProperties->SetPropertyL(_L8("PropertyName6"), _L8("PropertyValue6"),                              MSenLayeredProperties::ESenMessageLayer);    TPtrC8 propertyValue;                                  pProperties->PropertyL(_L8("PropertyName1"), propertyValue);                                  pAsXml = pProperties->AsUtf8LC();    LOCAL_ASSERT( *pAsXml == KOutputString );    CleanupStack::PopAndDestroy(pAsXml);    TInt error;    pProperties2 = (CSenLayeredHttpTransportProperties*)pProperties->Clone(error);    LOCAL_ASSERT( error == KErrNone );    // Destroy cloned properties immediately after cloning    CleanupStack::PopAndDestroy(pProperties);    CleanupStack::PushL(pProperties2);    pAsXml = pProperties2->AsUtf8LC();    LOCAL_ASSERT( *pAsXml == KOutputString );    CleanupStack::PopAndDestroy(pAsXml);    CleanupStack::PopAndDestroy(pProperties2);        CleanupStack::PopAndDestroy(&stringPool);        return KErrNone;    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:31,


示例11:

	Local<Value> UnbindOperation::CreateCompletionArg()	{		auto a = statement->UnbindParams();		auto ret = a->Clone();		return ret;	}
开发者ID:TimelordUK,项目名称:node-sqlserver-v8,代码行数:6,


示例12: plotUnfoldingMatrixRooUnfold

//.........这里部分代码省略.........    TString subdir="ShapeReweight";    TString field="zeeMCShapeReweight_";    TString ddBkg=(inpMgr.userKeyValueAsInt("DDBKG")==1) ? "ddBkg" : "mcBkg";    field.Append(ddBkg);    std::cout << "Obtaining shape weights from <"	      << shapeFName << ">"	      << "(use" << ddBkg << ")/n";    h2ShapeWeights=LoadHisto2D(field,shapeFName,subdir,1);    if (!h2ShapeWeights) {      std::cout << "failed to find histo /"ZeeMCShapeReweight/"/n";      return retCodeError;    }    if ((DYTools::massBinningSet==DYTools::_MassBins_2012) &&	(DYTools::study2D==1)) {      HERE("set weights for the underflow bin to 1.");      int ibin=1;      for (int jbin=1; jbin<=24; jbin++) {	h2ShapeWeights->SetBinContent(ibin,jbin, 1.);	h2ShapeWeights->SetBinError  (ibin,jbin, 0.);      }    }    std::cout << "shapeWeights:/n"; printHisto(h2ShapeWeights);    int ensembleSize= inpMgr.userKeyValueAsInt("RESIDUAL_STUDY_SIZE");    if (ensembleSize<=0) ensembleSize=100;    ensembleSize++;    std::cout << "EScale_residual ensemble size=" << ensembleSize	      << " (one added for non-randomized entry)/n";    std::vector<TString> tmpLabelV; // local variable for testing    specTH2DWeightV.reserve(ensembleSize);    tmpLabelV.reserve(ensembleSize);    specTH2DWeightV.push_back(Clone(h2ShapeWeights,				    "h2NonRndShapeW","h2NonRndShapeW"));    tmpLabelV.push_back("NonRndShape");    if (!escaleResidual_global) {      TH2D *h2ResApply=Clone(h2ShapeWeights,"h2ResApply");      // vary randomly and independently in each bin      // prepare histo for randomization. Assume 10% error on the deviation      for (int ibin=1; ibin<=h2ResApply->GetNbinsX(); ++ibin) {	for (int jbin=1; jbin<=h2ResApply->GetNbinsY(); ++jbin) {	double dev=h2ResApply->GetBinContent(ibin,jbin);	//h2ResApply->SetBinError(ibin,jbin, 0.1*dev);	h2ResApply->SetBinError(ibin,jbin, 1.);	h2ResApply->SetBinError(ibin,jbin, dev);	}      }      HistoPair2D_t hpRnd("hpRnd",h2ResApply);      for (int i=1; i<ensembleSize; ++i) {	TString name=Form("rndShapeWeight_%d",i);	TH2D* h2Rnd=hpRnd.randomizedWithinErr(0,name);	specTH2DWeightV.push_back(h2Rnd);	tmpLabelV.push_back(name);      }    }    else { // global variation      for (int i=1; i<ensembleSize; ++i) {	double rnd=gRandom->Gaus(0,1.);	TString name=Form("rndShapeWeight_%d",i);	TH2D *h2Rnd=Clone(h2ShapeWeights,name);	for (int ibin=1; ibin<=h2Rnd->GetNbinsX(); ++ibin) {	  for (int jbin=1; jbin<=h2Rnd->GetNbinsY(); ++jbin) {
开发者ID:andjuo,项目名称:DYee,代码行数:67,


示例13: ZeroMallocFast

万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。