Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6046059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:11:42+00:00 2026-05-23T07:11:42+00:00

I have an object like below class MyClass{ int a; double b; }; and

  • 0

I have an object like below

 class MyClass{
   int a;
   double b;
 };

and

 vector<MyClass> vMyClass;

then I want search in vMyClass try to use algorithm function:

 if( std::find(vMyClass.begin(), vMyClass.end(), aiField) == vMyClass.end())

I also defined operator==

 int operator ==(Field &Left,Field &Right)
 {
    return memcmp(&Left,&Right,sizeof(Field));
 }

or

int operator ==(Field &Right)
{
    return memcmp(this,&Right,sizeof(Field));
}

but I get an error message.

1>c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\algorithm(40) : error C2678: binary '==' : no operator found which takes a left-hand operand of type 'MyClass' (or there is no acceptable conversion)
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\guiddef.h(192): could be 'int operator ==(const GUID &,const GUID &)' [found using argument-dependent lookup]
1>        c:\users\shmuelian\documents\visual studio 2008\projects\src\examples\DLgenerator\DLParser.h(85): or       'int operator ==(MyClass &,MyClass &)' [found using argument-dependent lookup]
1>        c:\users\shmuelian\documents\visual studio 2008\projects\src\examples\DLgenerator\DLParser.h(70): or       'int MyClass::operator ==(MyClass &)'
1>        while trying to match the argument list '(MyClass, const MyClass)'
1>        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\algorithm(74) : see reference to function template instantiation '_InIt std::_Find<std::_Vector_iterator<_Ty,_Alloc>,_Ty>(_InIt,_InIt,const _Ty &)' being compiled
1>        with
1>        [
1>            _InIt=std::_Vector_iterator<MyClass,std::allocator<MyClass>>,
1>            _Ty=MyClass,
1>            _Alloc=std::allocator<MyClass>
1>        ]
1>        c:\users\shmuelian\documents\visual studio 2008\projects\src\examples\DLgenerator\DLParser.h(108) : see reference to function template instantiation '_InIt std::find<std::_Vector_iterator<_Ty,_Alloc>,MyClass>(_InIt,_InIt,const _Ty &)' being compiled
1>        with
1>        [
1>            _InIt=std::_Vector_iterator<MyClass,std::allocator<MyClass>>,
1>            _Ty=MyClass,
1>            _Alloc=std::allocator<MyClass>
1>        ]
1>CommandArgParser.cpp
1>Generating Code...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:11:43+00:00Added an answer on May 23, 2026 at 7:11 am

    They need to be const references. And memcmp is really, really bad- just perform a member-wise comparison.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's suppose I have this object: [Serializable] public class MyClass { public int Age
I have a generic class like below: public class MyClass<T, TProperty> { MyClass(Expression<Func<T, TProperty>>
I'm just wondering .. I have and object like this public class Entry{ public
I defined such simple class as below: >>> class myclass(object): name = google And
We have a structure like below: template<size_t size> class Container{ public: char characters[size]; };
I have defined an extension method in app_code like below. public static class Extensions
I'd like to pass java class object to JNI method, And I want to
I have many-to-many relationship between Game and Account models like below: class Account <
i have class like below class Person { public string Name{get;set;} public string Surname{get;set;}
I have a large (more than 100K objects) collection of Java objects like below.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.