can't change the pointer, but can change the object the pointer refers to. Well, there are no such pointers in MQL5 that can't be changed. Therefore, the const modifier always refers to the objects, to which the pointer refers.
Then where do you think the constant pointer is here!
In methods f() and g() the a pointer becomes constant.
Well, there are no such pointers in MQL5 that can't be changed. Therefore, the const modifier always refers to the objects to which the pointer refers
You should not make such categorical conclusions without sufficient knowledge about the subject. MQL has constant pointers and declared them the same way as in C++.
You should not make such categorical conclusions without sufficient knowledge of the subject. Constant pointers in MQL exist and are declared the same way as in C++.
template<typename T>
class A { public:
booloperator==( const A& ); //error: 'operator' - function must have a body
T t;
};
class B {
A<int> a;
};
template<typename T>
bool A::operator==( const A& ) { returnfalse; }
voidOnStart()
{
A<int> a, b;
Print( a == b );
}
This would have been compatible with C++, on the other hand - only class B "interferes" there - if you remove it, it compiles without errors. This is the reason why it is aimed at checking
template<typename T> class A {};
template<typename T> class B {};
class C {
template<typename T>
void f( B<A<T> > * ) {}
B<A<int> > *b;
public:
void g() { f( b ); } //error: 'f' - cannot to apply function template
};
You believe that
can't change the pointer, but can change the object the pointer refers to. Well, there are no such pointers in MQL5 that can't be changed. Therefore, the const modifier always refers to the objects, to which the pointer refers.
Then where do you think the constant pointer is here!
In methods f() and g() the a pointer becomes constant.
Well, there are no such pointers in MQL5 that can't be changed. Therefore, the const modifier always refers to the objects to which the pointer refers
You should not make such categorical conclusions without sufficient knowledge about the subject. MQL has constant pointers and declared them the same way as in C++.
You should not make such categorical conclusions without sufficient knowledge of the subject. Constant pointers in MQL exist and are declared the same way as in C++.
As far as I remember the developers' explanation, constancy applies to both object and pointer.
I.e. writing const T* in MQL === const T* const in C++
It was like that before, perhaps it is different now, but I doubt it.
Compilation error
Compilation error
...
It should have been like this:
It should have been like this:
Compilation error
Compilation error