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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:18:37+00:00 2026-05-27T15:18:37+00:00

My quest continues ! I started using a list for my priority queue std::priority_queue<charElement,std::list<charElement>,compareCharElt>

  • 0

My quest continues ! I started using a list for my priority queue

std::priority_queue<charElement,std::list<charElement>,compareCharElt> Q_freqDistribution;

where charElement does not (as of this erroneous compilation) overload the ‘-‘ operator

When I got this error :

std::_List_unchecked_iterator<_Mylist>' does not define this operator or a conversion to a type acceptable to the predefined operator *

I looked it up and from what I understood , it seemed that in order for me to be able to use a list (I assume for the iterator to be able to traverse elements) I needed to overload the ‘-‘ operator , so I did , here’s the method header :

void operator-(charElement&);

At this point I just wanted a dummy operator to make sure what I understood was correct, sadly , I am wrong , I’ve been searching for a while about this now and I cant seem to be able to pin point the problem, can anyone help ?

  • 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-27T15:18:37+00:00Added an answer on May 27, 2026 at 3:18 pm

    The underlying container for a priority_queue must be a sequence container with random access iterators (and front(), push_back() and pop_back() operations). list has bidirectional iterators, not random access iterators, so you can’t use it here.

    You can use vector (the default), deque, or any non-standard container that meets these requirements.

    You shouldn’t need to overload operator- for your type; the compiler is complaining that operator- is not overloaded for list::iterator. The only requirement on the type is that it can be compared with other values of that type; in your case, you’re providing a custom comparator for that.

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

Sidebar

Related Questions

I'm using the Quest AD cmdlets, particularly Get-QADUser, to pull a list of users
I'm using Quest's TOAD for SQL Server on a SQL Server 2000 Server. Here
We are using Quest Geo Solution's Grid InQuest DLL (GIQ60.DLL) within an SQL Server
I am using Clear Quest 7.0.1.4 and have created a Personal Query. However, I
I'm reading this article by Jon Skeet as part of my quest to get
My quest of starting to use namespaces in PHP keeps continuing. This time PHPUnit
As I continue my quest of learning functional programming, I've come to wonder if
On a quest to migrate some new UI into Managed/C# land, I have recently
In the quest for localization I need to find all the string literals littered
In my quest to learn javascript (which seems to be my latest source of

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.