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 » U++ Library support » U++ Core » ONE and assignement
ONE and assignement [message #50101] Sat, 28 July 2018 09:48 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Hi,

I'm right that One<> is missing those operators?

	template <class TT>
	void        operator=(One<TT>&d) = delete;

	template <class TT>
	void        operator=(One<TT> const &d) = delete;


In an application I've noticed that if I do :

	One<String> A = new String("pippo");
	One<String> B;
	B = A;
	Cout() << "*A = " << *A << "\n";
	Cout() << "*b = " << *B << "\n";


The internal pointer is copied, NOT picked, and NO COMPILER ERROR IS GENERATED, so when A and B get destroyed the pointer is
double freed and I get a violation access error.
Adding the above operators brings a compiler error, which is the correct behaviour, IMHO.

Ciao

Max
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: RegExp this'n that
Next Topic: [solved] Extensions to Xmlize for arrays
Goto Forum:
  


Current Time: Thu Jul 18 03:44:26 CEST 2024

Total time taken to generate the page: 0.01898 seconds