The MQL5 library seems to violate const-correctness

 
As I was writing my code (posting it is not relevant for this subject) I've run into some problems related to various functions where I declared parameters as const& (constant references) to objects. These errors were caused by the library.
When I looked in the library code, sure enough, no method is declared as const even though it doesn't modify the object. Down below I've attached an example of two methods that, in my mind, should be declared as const.

Being unable to declare an object as const is problematic for code robustness and debugging, as you all know. So, am I wrong here? Or is the library code just poorly written?
template<typename TKey,typename TValue>
bool CHashMap::ContainsKey(TKey key)
  {
   return(FindEntry(key)>=0);
  }

template<typename TKey,typename TValue>
bool CHashMap::TryGetValue(TKey key,TValue &value)
  {
//--- find pair with specified key
   int i=FindEntry(key);
//--- check index
   if(i>=0)
     {
      //--- get value     
      value=m_entries[i].value;
      return(true);
     }
   return(false);
  }
 
  1. If you complain about an error please provide the error messages in the logs.

  2. See here about the use of templates: https://www.mql5.com/en/book/oop/templates/templates_objects.

  3. Or place the cursor on template and press F1 ..
MQL5 Book: Object Oriented Programming / Templates / Object type templates
MQL5 Book: Object Oriented Programming / Templates / Object type templates
  • www.mql5.com
An object type template definition begins with a header containing typed parameters (see section Template Header ), and the usual definition of a...
 
Popescu Paul:
As I was writing my code (posting it is not relevant for this subject) I've run into some problems related to various functions where I declared parameters as const& (constant references) to objects. These errors were caused by the library.
When I looked in the library code, sure enough, no method is declared as const even though it doesn't modify the object. Down below I've attached an example of two methods that, in my mind, should be declared as const.

Being unable to declare an object as const is problematic for code robustness and debugging, as you all know. So, am I wrong here? Or is the library code just poorly written?

It's just poorly written.

 
Alain Verleyen #:

It's just poorly written.

Hopefully this attracts their attention to fix it, I guess. All they have to do is place the "const" keyword, after all. I am not going to tamper with the clientside code myself because that would probably cause more issues than it would fix.