Errors, bugs, questions - page 2743

 
Roman Agafonkin:

That's the thing, it's not coming back... on mt4 it's fine... on mt5 - alas, it's glitchy...
OK, I'll shoot a video and add it to this thread.

I have an indent after scaling back on MT5 (2361).
 
class Originator
  {
   int               state;
public:
   class Memento;
   Originator() : state(0){}
   Memento*          getMemento()      {return new Memento(&this);}
   void              setState(int s)   {state=s;}
   void              dumpState()       {printf("State: %i", state);}
///////////////////////////////////////////////////////////
   class Memento{
      int            state;
      Originator*    org;
      public:
                     Memento(Originator* mOrg):state(mOrg.state),org(mOrg){}
      void           restoreState() {org.state=state;}
   };
///////////////////////////////////////////////////////////
  };

Why is there no error: cannot access to private members?

 
Vladimir Simakov:

Why no error: cannot access to private member?

BecauseMementois a Nested/Internal class in relation toOriginator

 
Sergey Dzyublik:

BecauseMementois a Nested/Internal class in relation toOriginator

Thank you.

 

Mistake:

class class_A
  {
   struct struct_1
     {
      int            my_secret_key;
     };

   void              Get_key()
     {
      struct struct_local
        {
         struct_1     st1;
        };
     };
  };
cannot access to private struct 'struct_1' declared in class 'class_A'  test3.mq5       24      10
   see declaration of struct 'class_A::struct_1'        test3.mq5       15      11
Билд 2430.
 
I'll add:
class A {};
struct B {
        struct A {};
        B() { ::A a; } //Error: 'A' - unexpected token
};
 
Suggestion to the developers.
Please consider adding in MQL a function that allows users to independently call processing of accumulated "messages" inOnChartEvent from custom code.
1) This would allow calling OnChartEvent handling between iterations of a time-consuming calculation, making the user GUI at least somewhat responsive without constructing a vegetable garden of: task pool, data transfer, state synchronization, context saving and restoring...
2) This would allow using OnChartEvent in scripts.

Thanks.
 
Sergey Dzyublik:
MT5 bug (build 2340) no access to default operator= from pointer object.

Thanks for the message.
Corrected by

 
Sergey Dzyublik:
Suggestion to the developers.
Please consider adding in MQL a function that allows users to independently call processing of accumulated "messages" in OnChartEvent from custom code.
1) This would allow calling OnChartEvent handling between iterations of a time-consuming calculation, making the user GUI at least somewhat responsive without constructing a vegetable garden of: task pool, data transfer, state synchronization, context saving and restoring...
2) This would allow using OnChartEvent in scripts.

Thank you.
Are you suggesting to add GetNextEvent function ?
 
Ilyas:
Are you suggesting to add GetNextEvent function ?

Including TradeTransaction-events.


Two overloads - Trade-Event, Chart-Event.

Reason: