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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:55:17+00:00 2026-06-14T18:55:17+00:00

I thought I had this figured out, but I guess I was wrong. I

  • 0

I thought I had this figured out, but I guess I was wrong. I was under the impression that the first element in ‘<…>’ is the type that is to be stored in the queue, the second is the container type (the choices being ‘vector’ or ‘dequeue’) and the third is the class that overloads the ‘()’ operator for comparison. Based on this, I think the following code should compile, but it does not 🙁

std::priority_queue<uint32_t*, std::vector<uint32_t*>, edgeComparator> q();

uint32_t* nodeEdge = new uint32_t[2];
nodeEdge[0] = startN;
nodeEdge[1] = 0;

q.push(nodeEdge);

‘edgeComparator’ is defined as follows:

class edgeComparator
{
   public:
      bool operator() (const uint32_t*& lhs, const uint32_t*& rhs) const
      {
         return (lhs[1]>rhs[1]);
      }
};

Here is the error I’m getting:

./Graph.cpp: In member function `void Graph::findShortestPath()':
./Graph.cpp:148: error: request for member `push' in `q', which is of non-class type `std::priority_queue<uint32_t*, std::vector<uint32_t*, std::allocator<uint32_t*> >, edgeComparator> ()()'

Worse yet, I also get this error when trying ‘q.empty()’

./Graph.cpp:150: error: request for member `empty' in `q', which is of non-class type `std::priority_queue<uint32_t*, std::vector<uint32_t*, std::allocator<uint32_t*> >, edgeComparator> ()()'
  • 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-14T18:55:19+00:00Added an answer on June 14, 2026 at 6:55 pm

    You had:

    std::priority_queue<uint32_t*, std::vector<uint32_t*>, edgeComparator> q();
    

    But instead, you should use:

    std::priority_queue<uint32_t*, std::vector<uint32_t*>, edgeComparator> q;
    

    The first version declares a function named q, that takes no arguments, and returns a value of type std::priority_queue<...>.

    The second version declares a variable named q, of type std::priority_queue<...>, which is default-initialised.

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

Sidebar

Related Questions

I thought I had this all figured out, but now that I'm writing a
I thought I had this figured out but it turns out I'm just deleting
I'm going to ask this question again,I thought I had figured it out but
I thought I had this figured out, but I obviously don't. In an Android
I thought I had this figured out, but I'm wanting to find all occurances
I asked this question previously and thought I had it figured out but it
I thought I had this figured out, but I'm running into an issue. I'm
I thought I had this all figured out, but I'm hitting a brick wall.
I thought I had it figured out but now I'm missing something. First I
I thought I had this figured out, but can't get it working correctly: All

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.