hello i am building a template in c++ ,and i need to overwrite the operator “<” inside the template for being able to compare between items inside my data structure.
could anyone please tell me how to overwrite it … should i send a pointer to a function inside the constructor of the template?
I got two templates, the first one is Node template which includes a pointer to the data that i am managing.
and the second is a Heap template which has an vector of nodes*.
in my implementation i should be able to compare between nodes*.
hello i am building a template in c++ ,and i need to overwrite the
Share
Will this do? I have purposely provided ‘operator <‘ in the namespace scope so that it is more generic, though it is shown in comments how to do so.