Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » again... use if deleted function :?
Re: again... use if deleted function :? [message #49301 is a reply to message #49268] Thu, 18 January 2018 11:26 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1226
Registered: August 2007
Senior Contributor
Quote:

// constructor
QTFStr() = default;



it shouldn't be a solution?

Matteo


Hello Matteo,

There is a problem here:
QTFStr Tensoflessione::Instabilitaqtf(QTFStr &qtf)
{                                   // ----------
                                    //     ^
                                    // You are passing a reference (which can be modified, as you do below.    
                          
	String risultato;
	risultato << "(σ[, t,0,d]/ f[, t,0,d]) + (σ[, m,y,d]/ k[, crit] * f[, m,y,d]) + K[, m]*(σ[, m,z,d]/ f[, m,z,d]) <= 1 &";
	risultato << "(σ[, t,0,d]/ f[, t,0,d]) + K[, m]*(σ[, m,y,d]/ f[, m,y,d]) + (σ[, m,z,d]/ k[, crit] * f[, m,z,d]) <= 1 ";
	risultato << GetVerificaInst();
	
	qtf.StartTable(3,2,2,10).CharSize(12);
	qtf.TableSubTitle("Instabilità flesso-torsionale");
	qtf.LeftCellMargin(75)("l[, eff]").LeftCellMargin(15).AlignRight()
		(Format("%.2f", GetInstab().leff)).AlignLeft()("mm")("Lunghezza libera di inflessione");
	qtf.LeftCellMargin(75)("σ[, crit]").LeftCellMargin(15).AlignRight()
		(Format("%.2f", GetInstab().sigmam_critico)).AlignLeft()("")("Tensione critica di svergolamento");
	qtf.LeftCellMargin(75)("λ[, rel]").LeftCellMargin(15).AlignRight()
		(Format("%.2f", GetInstab().lambda_relm)).AlignLeft()("")("Snellezza relativa di svergolamento");	
	qtf.LeftCellMargin(75)("k[, crit]").LeftCellMargin(15).AlignRight()
		(Format("%.2f", GetInstab().kcrit)).AlignLeft()("N/mm[` 2]")("Coefficiente di sbandamento laterale");	
	qtf.TableSubTitle(risultato);
	qtf.EndTable();
		
	qtf.TableSubTitle(risultato);
	qtf.EndTable();
		
	return qtf;
       //----------
       //  ^
       // Then, compiler attempts (by default) to copy qtf (But you need to explicitly define a copy constructor, which is missing, and in it, explicity copy the members of your class (using clone() ), They are causing the error.)
       // By the way, returning a QTFStr from this function shoudn't be necessasy at all, since you are already modifying the referenced instance! (it is non-const), unless you really need a copy of it. It is a much cheaper solution.
}



OR, if you don't use the referenced variable qtf after calling the method but you need your method to return a QTFStr, you can move it instead.
[
      QTFStr(QTFStr&&) = default;
      QTFStr& operator=(QTFStr&&) = default;



Then,

return pick(qtf);


And please read about copy and move semantics of both C++11 (StackOverFlow has plenty of good articles on it), and UPP.


Best regards,
Oblivion


[Updated on: Thu, 18 January 2018 11:30]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stacked column chart
Next Topic: Issue encountered building U++...
Goto Forum:
  


Current Time: Sun Aug 24 21:42:58 CEST 2025

Total time taken to generate the page: 0.05012 seconds