Hm, I just copied this code from the help and it compiled without problem:
template<typename T> T ArrayMax(T &arr[]) { uint size=ArraySize(arr); if(size==0) return(0); T max=arr[0]; for(uint n=1;n<size;n++) if(max<arr[n]) max=arr[n]; //--- return(max); }
Mt4, build 646, MetaEditor v.934
I did not run that code though.
Add "&" in front of "arr[]" in the function specification. Arrays can be passed by reference only. Maybe that is the reason for compiler error.
Yes, now it's OK!
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I'm trying to use templates in my program, however compiler produces error 'template functions overloading is not supported yet'. My code is following:
template<typename T>
void Create(T arr[])
{
}
I have metatrader version 4.00 build 646. As I have understood from documntation this version should support templates.