Hmm, im not that advanced ,so the goal is to be able to instantiate global class objects from within functions
on runtime ?
it is used to free the object. it allow you to no worry to forget the memory of new obj. the memory is automaticly released whenever no pointer to
the object. refer to boost lib in c++ for more information
class Foo{
public:
void bar(){}
};
SharedPointer<Foo> getFoo(){
SharedPointer<Foo> sp = new Foo;
SharedPointer<Foo> sp2 = sp;
sp.p.bar();
return sp; // sp&sp2 destructed after this function call, but memory of Foo obj not released here
}
void testSharedPointer(){
SharedPointer<Foo> sp3 = getFoo();
sp3.p.bar();
// no need to call delete sp2. memory released only when all SharedPointer obj destructed.
} // sp2 destructed after function call and memory released, as there is no other SharedPointer to the Foo obj.void testPointer(){
Foo* p = new Foo;
Foo* p2 = p;
delete p; // must release
p2.bar(); // error: invalid pointer access
}
Hmm, im not that advanced ,so the goal is to be able to instantiate global class objects from within functions on runtime ?
it is used to free the object. it allow you to no worry to forget the memory of new obj. the memory is automaticly released whenever no pointer to the object. refer to boost lib in c++ for more information
Reported to Russian forum for more visibility.
I don't know Russian. Thank for help.
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Новая версия платформы MetaTrader 5 build 2280
Ilyas, 2020.03.17 17:29
Thank you for your message. It has been fixed Fixed