473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Problem with unique and a binary predicate?

BCC
What the heck am I doing wrong?

void MyClass::JoinIdenticalFingerprints(CFPrintList& list)
{
CFPrintList unique_list = list;
unique(unique_list.begin(), unique_list.end(), UniquePredicate);
}

bool MyClass::UniquePredicate(const CFPrint& x, const CFPrint& y)
{
return x == y;
}

I get an error:
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\algorithm(547): error C2064: term does not evaluate to
a function taking 2 arguments

The example I followed was the help file from MSDN, looks pretty much
the same to me.

It must be something really simple... is there anything obviously wrong
with they way I create and call unique with a predicate??

Thanks
Jul 22 '05 #1
2 1607
BCC wrote:
What the heck am I doing wrong?

void MyClass::JoinIdenticalFingerprints(CFPrintList& list)
{
CFPrintList unique_list = list;
unique(unique_list.begin(), unique_list.end(), UniquePredicate);
}

bool MyClass::UniquePredicate(const CFPrint& x, const CFPrint& y)
{
return x == y;
}

I get an error:
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\algorithm(547): error C2064: term does not evaluate to
a function taking 2 arguments

The example I followed was the help file from MSDN, looks pretty much
the same to me.

It must be something really simple... is there anything obviously wrong
with they way I create and call unique with a predicate??


Your "predicate" is probably a non-static member, which requires one
additional argument, "this", to perform its actions. Since the function
does not seem to do anything 'MyClass'-related, you could declare it
static (if you didn't). If my guess is not right, post more code (the
'MyClass' definition is one important piece missing here.

Victor
Jul 22 '05 #2
BCC
>
Your "predicate" is probably a non-static member, which requires one
additional argument, "this", to perform its actions. Since the function
does not seem to do anything 'MyClass'-related, you could declare it
static (if you didn't). If my guess is not right, post more code (the
'MyClass' definition is one important piece missing here.

Victor


Good guess! :)

Declaring it static worked.

Thanks!
B
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Hemant Shah | last post by:
Folks, We have an SQL statement that was coded in an application many years ago (starting with DB V2 I think). When I upgraded to UDB 8.2, the optimizer does not use optimal path to access the...
15
by: Andrew Maclean | last post by:
I guess this problem can be distilled down to: How do I search through a string, find the first matching substring, replace it, and continue through the string doing this. Can replace_if() be used...
2
by: Suma | last post by:
A newbie question : I have a vector of objects(pointers) . I have a function which overloads the less than operator . I can sort the objects without a problem. However when I pass the same...
5
by: Peter Olcott | last post by:
I created an object that requires access to another objects data, yet have found no good way to pass this data as a parameter because the member function that requires this data must be a binary...
18
by: jslowery | last post by:
I am not completely knowledgable about the status of lexical scoping in Python, but it was my understanding that this was added in a long time ago around python2.1-python2.2 I am using python2.4...
4
by: mpietrzyk | last post by:
Hi guys I'm having a nasty problem with bulk copying into a table that has unique identifier column. I'm coding on C++, using ODBC driver. I'm coping from a file containing UID description...
16
by: Cory Nelson | last post by:
Does anyone know how std::set prevents duplicates using only std::less? I've tried looking through a couple of the STL implementations and their code is pretty unreadable (to allow for different...
4
by: BenCoo | last post by:
Hello, In a Binary Search Tree I get the error : Object must be of type String if I run the form only with the "Dim bstLidnummer As New BinarySearchTree" it works fine. Thanks for any...
16
by: shapper | last post by:
Hello, I have a generic list as follows: Dim rows As New Generic.List(Of row) Now I have a row: Dim myRow As row I tried to check, further in my code, if the row is nothing: If myRow Is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.