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 6844255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:21:15+00:00 2026-05-27T00:21:15+00:00

The following errors are always been pointing to my List. In my class file

  • 0

The following errors are always been pointing to my List.

In my class file

Point3D operator==(const Point3D &p1) const;

In my .cpp file

bool operator==(Point3D &p1, Point3D &p2)
{
    if ( p1.getX() == p2.getX() && p1.getY() == p2.getY() && p1.getZ() == p2.getZ() )
        return true;
    else
        return false;
}

In my main file

//declaration
list<Point3D> l_3D;

l_3D.unique(); <-- the error point to this 

Error message

..... In member function 'void std::list<_Tp,_Alloc>::unique() [with_Tp = Point3D,_Alloc = std:: allocator<Point3D>]:

Instantiated from here

error: could not convert 'Point3D::operator==(const Point3D&) const (((const Point3D&)((const Point3D*)__next. std::_List_iterator<_Tp>::operator*[with_Tp = Point3D]())))' to 'bool'

To the kind souls out there, I thank you in advance.

  • 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-27T00:21:15+00:00Added an answer on May 27, 2026 at 12:21 am

    In your declaration you return Point3D, which should be bool:

    Point3D operator==(const Point3D &p1) const;
    ^^^^^^^
    should be bool
    

    The above looks like you declare the operator as a member-function, bet then you implement it as a free function. You have to decide which it is. If you use a member-function, change the implementation to:

    bool Point3D::operator==(const Point3D &p2) const
    {
        if ( getX() == p2.getX() && getY() == p2.getY() && getZ() == p2.getZ() )
            return true;
        else
            return false;
    }
    

    Or even better (as per @ibids comment):

    bool Point3D::operator==(const Point3D &p2) const
    {
        return (getX() == p2.getX() && getY() == p2.getY() && getZ() == p2.getZ());
    }
    

    Generally the signature of your definition should match the signature of your declaration.

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

Sidebar

Related Questions

I run into the following errors when i try to store a large file
In my views I've been always including the following section (not very DRY): <%
Why do I always get the following error from Postgres? syntax error at or
When I try to do the select statement, I always get the following error:
I am using following PHP code for trigger creation but always get error, please
I am getting the following errors: PHP Warning: Module 'ldap' already loaded in Unknown
Eclipse is showing the following errors in my Spring's applicationContext.xml : cvc-complex-type.2.4.c: The matching
I am getting the following errors when i am trying to index the SVN
I am getting following errors on my console repeatedly log4j:ERROR Attempted to append to
I'm currently receiving the following errors in wifi communication: Cannot refer to a non-final

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.