Download MetaTrader 5
To add comments, please log in or register
Search in documentation is available via MetaTrader 5. Search and learn!
Tom Test
19
Tom Test 2015.02.02 22:37 

Dear MQL4 Users,

is it possible to return a reference in MQL4? E.g. to a member variable. In C++ this is common practice, but I get an ugly "reference cannot used" error from the mql4 compiler.

Thanks in advance,
Tom

Carl Schreiber
5954
Carl Schreiber 2015.02.02 23:17  

You can 'hand over' a variable by reference:

void func( double &var ){..}

But I think you know it.

whroeder1
13627
whroeder1 2015.02.03 02:32  
tomtester: is it possible to return a reference in MQL4?
  1. Return Operator - MQL4 Documentation What can be returned: simple types, simple structures, object pointers.
  2. //+------------------------------------------------------------------+
    //| Mql4 is like C++ except: no typedefs or namespaces, no pointers  |
    //| to POD, no operator(), operator*, or operator->, no implicit     |
    //| conversions (operator bool), no templated classes, no Koenig     |
    //| lookup, can't return references, no dynamic cast, no exceptions, |
    //| no class friends, no multiple inheritance. Can't use template    |
    //| <class X...> must be template <typename x...>. f(const T&){}     |
    //| f(123) or f( f2() ) doesn't compile (Build 765.) Must have a     |
    //| actual variable. Structures must be passed by reference.         |
    //+------------------------------------------------------------------+
    




/
To add comments, please log in or register