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

  • Home
  • SEARCH
  • 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 9115909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:32:43+00:00 2026-06-17T04:32:43+00:00

A pseudo code (this is my class): struct cTileState { cTileState(unsigned int tileX, unsigned

  • 0

A pseudo code (this is my class):

struct cTileState   {
        cTileState(unsigned int tileX, unsigned int tileY, unsigned int texNr) : tileX(tileX), tileY(tileY), texNr(texNr) {}
        unsigned int tileX;
        unsigned int tileY;
        unsigned int texNr;

        bool operator==(const cTileState & r)
        {
            if (tileX == r.tileX && tileY == r.tileY && texNr == r.texNr) return true;
            else return false;
        }
    };

Then I have two containers:

       std::list < std::vector <cTileState> > changesList;  //stores states in specific order
       std::vector <cTileState> nextState;

And somewhere in programm I want to do that in my state swap function:

      if (nextState == changesList.back()) return;

However, when I want to compile it I have some meaningless for me errors, like:

/usr/include/c++/4.7/bits/stl_vector.h:1372:58: required from ‘bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) [with _Tp = cMapEditor::cActionsHistory::cTileState; _Alloc = std::allocator]’

error: passing ‘const cMapEditor::cActionsHistory::cTileState’ as ‘this’ argument of ‘bool cMapEditor::cActionsHistory::cTileState::operator==(const cMapEditor::cActionsHistory::cTileState&)’ discards qualifiers [-fpermissive]

It says something is wrong in stl_vector.h and that I don’t respect const qualifiers, but honestly there are no const qualifiers that I don’t respect. What’s wrong here?

What’s more, ide doesn’t show me the error in any specific line in my files – it just displays in build log and that’s all.

  • 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-06-17T04:32:45+00:00Added an answer on June 17, 2026 at 4:32 am

    You need to make your member function const, so that it accepts a const this argument:

    bool operator==(const cTileState & r) const
                                          ^^^^^
    

    Better yet, make it a free function:

    bool operator==(const cTileState &lhs, const cTileState & rhs)
    

    Making the member function const approximately corresponds to the const in const cTileState &lhs, whereas a non-const member function would have a cTileState &lhs equivalent. The function the error is pointing to tries to call it with a const first argument, but your function only accepts a non-const one.

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

Sidebar

Related Questions

With pseudo code like this: class FooBar { public: int property; static int m_static;
The basic pseudo code looks like this: void myFunction() { int size = 10;
I have an object model that looks like this (pseudo code): class Product {
Consider this pseudo code: // an image is initialized UIImage *imagePX = [[UIImage alloc]initWithContentsOfFile:...
Trying to figure out this pseudo code. The following is assumed.... I can only
Hi I have below pseudo code with throws an exception like this throw new
Here's what I'm trying to do -- this is pseudo code and doesn't work.
Why can't I do something like this in c# (pseudo code follows) Interface1 {
NOTE: This question is written in a C# like pseudo code, but I am
I have this pseudo code: for i = 0 ... P.length C[i] = P[i]

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.