Discussing the article: "From Basic to Intermediate: Template and Typename (III)"

 

Check out the new article: From Basic to Intermediate: Template and Typename (III).

In this article, we will discuss the first part of the topic, which is not so easy for beginners to understand. In order not to get even more confused and to explain this topic correctly, we will divide the explanation into stages. We will devote this article to the first stage. However, although at the end of the article it may seem that we have reached the deadlock, in fact we will take a step towards another situation, which will be better understood in the next article.

In the previous article: “From Basic to Intermediate: Template and Typename (II)“, we explained how to handle some specific everyday situations for programmers. Whether it is your temporary hobby or you are a professional programmer, using function and procedure templates can be quite useful at certain times. Although this is not very common in MQL5 and is not always applicable, it is useful to know that such a concept is available for application and that it has its own points one should understand correctly so as not to get confused when trying to modify the code that eventually uses such simulation.

Templates do not just apply to functions and procedures. In fact, they have a wide range of practical applications, which more or less depends on the type of application you want to develop. It is worth mentioning - and emphasizing this once again - that we can implement the same kind of application without using templates. However, using such a tool and resource from MQL5 makes the implementation stage easier and more enjoyable. As well, it also helps avoid some types of complex and annoying detection failures.


Author: CODE X

 
Probably not Averange(), but Average()....
 
I think you need to specify the data type to the compiler when declaring a union implemented through a template.
un_01 <ulong> info;