I get a compiler error, and can't seem to wrap my head around the actual problem
Say I have the following code (reduced to a dummy minimum for purpose of demonstration):
#include "c4d.h"
class Int32Pair
{
public:
Int32Pair() : a(0), b(0) {}
Int32Pair(const Int32& _a, const Int32& _b) : a(_a), b(_b) {}
virtual ~Int32Pair() {}
private:
Int32 a;
Int32 b;
};
class Test
{
public:
Test()
{
maxon::BaseArray<Int32Pair> somedata;
if (somedata == mPairArray)
{
// do something
}
}
~Test() {}
private:
maxon::BaseArray<Int32Pair> mPairArray;
};
Basically, I have two arrays of Int32Pair which I want to compare, but compiler gives me a
error C2338: IsEqual not defined.
Which I have narrowed done as being caused by the line
if (somedata == mPairArray)
Where should this IsEqual
be defined?
Inspired by the SortedArray
example I tried adding an IsEqual into the Int32Pair class as:
static maxon::Bool IsEqual(const Int32Pair& p1, const Int32Pair& p2) { return (p1.a == p2.a) && (p1.b == p2.b); }
But compiler still complains about IsEqual not being defined.
As such, I am guessing it's the BaseArray
which needs to be defined with a compare method. But how? Have tried looking into the BaseArray manual, but failed to find any answer.
I would appreciate an example showing how it needs to be done. Thanks in advance.