Home » U++ Library support » U++ Core » ONE and assignement
ONE and assignement [message #50101] |
Sat, 28 July 2018 09:48  |
mdelfede
Messages: 1308 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
|
|
|
Goto Forum:
Current Time: Sun May 11 02:52:48 CEST 2025
Total time taken to generate the page: 0.00834 seconds
|