Trying to understand CArrayObj, can someone explain what "objvector<objvector<MySymbol>> myMatrix;" does?

 

I found some enticing code at https://www.forexfactory.com/thread/672478-the-most-useful-mql-data-structure-object-vectors. I'm new to C++ syntax and OO coding, my way in being MQL4 (I know, I know, I need to move to MQL5 but first, so does my broker lol.)

These lines are stumping me:

 //declaring a vector of vectors (matrix)
   objvector<objvector<MySymbol>> myMatrix;
  
   //declating a pointer to a vector of MySymbols and creating the first object in memory
   objvector<MySymbol>           *myVector = new objvector<MySymbol>;

I have no clue what the < and > operators are doing there in "objvector<objvector<MySymbol>> myMatrix;" and "objvector<MySymbol> *myVector = new objvector<MySymbol>;".

I'm not asking for a detailed explanation here (unless it's easy/trivial) but for any pointers I can get to explanations (link/book title/article title/whatever).

Can anyone help?

 




Mic test
.rec-mic-cls-1{fill-rule:evenodd;} mic
.rec-mic-cls-1{fill-rule:evenodd;} mic
 

that's a template, in other languages it is called Generics.

let you create a class based on different types. the type becomes the typename and let you instead of hardcoding the type use a generic name like T for that.


template<typename T>
class A{
   T Value;
   A(){}
};

A<int> aInt;
aInt.Value=1;

A<bool> aBool;
aBool.Value=true;


it can be applied to function or class though my example only shows a class one.


read more here:

https://www.mql5.com/en/docs/basis/oop/templates

Documentation on MQL5: Language Basics / Object-Oriented Programming / Function templates
Documentation on MQL5: Language Basics / Object-Oriented Programming / Function templates
  • www.mql5.com
Function templates - Object-Oriented Programming - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5