Errors, bugs, questions - page 1874

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If you are sure that the constructor must be private, there is no other way.
A smart pointer is an object that contains a simple pointer and ensures that it is removed in time.
This is the simplest option.
There are more complex smart pointers.
It's very well written about them in this book: https://rsdn.org/res/book/cpp/cpp_real_programmers.xml
As a matter of fact, it's logical that it doesn't work. You can't make the destructor of a smart pointer be called before the class destructor.
Instead of specifying the error and where it occurs, the compiler gives an unspecified internal error #112
Thank you! I tried different variants, but they do not work.
Actually, it's logical that it doesn't work. You can't make the destructor of a smart pointer be called before the class destructor.
Try the following way:
I don't know what you're doing, but in MQL making the constructor private makes sense only for the singleton.
Try it this way:
Thanks for the detailed example! Unfortunately, it doesn't have a closed constructor. It doesn't work like that with a closed one, of course.
What I need is for an object to exist that is hidden from everyone. At the same time, no other object of this type could be created in any way.
to output this to the execution log?
And is it correct that the __FUNCSIG__ of the constructor/destructor gives a void type?
Try it this way:
I need to have an object that is hidden from everyone. At the same time, another object of this type could not be created in any way.
That's what it's called:"Singleton".
Why do you say it's not suitable for you?
Here is an example of a singleton.
Is it correct in such a case
to output this to the execution log?
And is it correct that the __FUNCSIG__ of the constructor/destructor gives a void type?
Never do
Is it correct to output this to the execution log in such a case?
And is it correct that the __FUNCSIG__ of the constructor/destructor outputs void-type?
Yes, it is.
That's what it's called:"Singleton".
Why do you say it doesn't suit you?
Here's an example of a singleton.
Thank you very much, it works!
But it still remains a mystery.
Forum on trading, automated trading systems & strategy testing
Bugs, bugs, questions
fxsaber, 2017.04.25 10:34
Why is the smart pointer destructor called before the class destructor in your version and the opposite in mine (even if the constructor is public)?