B
BG
Here's my program.
{
array<Byte> ^buffer = // something
int length = Array::FindIndex(buffer, gcnew
Predicate<Byte>(&MyClass::isChar13) );
...
}
bool MyClass::isChar13(Byte b)
{
return b == 13;
}
This gives the error
error C3352: 'bool MyClass::isChar13(unsigned char)' : the specified
function does not match the delegate type 'bool (unsigned char)'
Now if I rewrite the predicate function like so
static bool MyClass::isChar13(Byte b) // note: made it static
{
return b == 13;
}
without changing the call to it, it compiles fine.
Can anyone explain what's happening? And must I make the predicate static?
Is there another way?
Thanks in advance.
{
array<Byte> ^buffer = // something
int length = Array::FindIndex(buffer, gcnew
Predicate<Byte>(&MyClass::isChar13) );
...
}
bool MyClass::isChar13(Byte b)
{
return b == 13;
}
This gives the error
error C3352: 'bool MyClass::isChar13(unsigned char)' : the specified
function does not match the delegate type 'bool (unsigned char)'
Now if I rewrite the predicate function like so
static bool MyClass::isChar13(Byte b) // note: made it static
{
return b == 13;
}
without changing the call to it, it compiles fine.
Can anyone explain what's happening? And must I make the predicate static?
Is there another way?
Thanks in advance.