Errors, bugs, questions - page 1966

 
A100:
I meant that the very possibility to place a method outside a class is handy.

Yeah, you just torture and torture, and then it turns out that you should have known certain secrets).

Maybe they have specialization of pattern classes too? I don't know, but I'm sure they have some clever way of doing it. I asked them for a long time in the service Desk and they keep silent. Probably, they have some secrets too. Spill )

 
Alexey Navoykov:

Maybe they have a specialisation of pattern classes too?

So long time ago!

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2017.08.16 13:19

typedef void (*fn)();

template<typename T>
void g( T Value ) { Print(typename(Value)); }
void f() {}

void g( fn Value ) { Print(typename(Value)); }
void OnStart()
{
        g( f ); // void(*fn)()
}

Or is there something else in mind?


ZS Found it.

 
fxsaber:

So how long ago!

Or is there something else in mind?

ZS Found it.

No, I was talking about class templates, not functions.

By the way, specialisation of function templates hasn't actually been implemented yet. What they called "specialization" in your link for some reason is actually quite different. And right now there's only the possibility of overloading with specific types. It's almost the same as specialization, the only difference being that the compiler doesn't control whether the signatures of all the overloaded functions are identical. This is necessary when the functions are in different places in the code.

 
A100:

It's much more convenient that way.

In case there are no specialisations.
 
Alexey Navoykov:

By the way, specialisation of function templates has not really been implemented yet. What they call "specialisation" in your link is not really what it is. And right now there is only the possibility of overloading with specific types. It's almost the same as specialization, the only difference being that the compiler doesn't control the identity of the signature of all the overloaded functions. You may need it when the functions are located in different code fragments.

I don't understand it without an example.

 
fxsaber:

Without an example, I don't understand.

In fact, I exaggerated there when I said "pretty much the same". The differences are significant, because only function arguments can be overloaded, and there may be other typenames in the template that are not related to arguments. And they can only be specialised. For example, a template with no arguments at all:

template<typename T>
void f() { }

template<>
void f<int>() { }
 
Alexey Navoykov:
Specialisation without argument? )) What will specialise in?
 
Комбинатор:
Specialisation without argument? )) And what will the specialization be for?
Well, you'll have to decide that in the body of the function. What's wrong here? I have such a need very often. I have to work it out by passing a dummy parameter, which is very crunchy.
 
Alexey Navoykov:
What's the big deal?
Nothing if you can get it to compile and run in the pros)
 

Immediately after upgrade to build 1650, when dragging an uncompiled Expert Draw from the Navigator/Favourites to a chart instead of the MQL5 cannot open file 'Draw.ex5' -> another Expert Advisor is launched, namely, ExpertMACD

Everything was fixed after compilation of Draw is finished, but the fact

I would like to add: The situation is repeated - ExpertMACD is launched instead of any non-compiled Expert Advisor

Reason: