Deque operator

error no match for operator <=

Page 1 of 1

3 Replies - 1172 Views - Last Post: 23 May 2009 - 11:50 AM Rate Topic: -----

#1 fx7202  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 09-February 09

Deque operator

Posted 23 May 2009 - 11:18 AM

happy sat everyone,

so here i am trying to finish a final project for class and cant get pass this step. so here is what i'm dealing with:

this is a process that uses a deque, depending on the user input the deque will be reduced from either sides. my prob lies in comparing the deque iterator to a int. here is the sample, (note: this is my first time working with deques)
neg.negSize = (h.hotNumber - 4);
deque<int>::iterator iterRandDequeListNeg = randDequeList.begin();
	
	  for (iterRandDequeListNeg; iterRandDequeListNeg != randDequeList.end(); iterRandDequeListNeg++)
		{
   		   if (iterRandDequeListNeg <= neg.negSize)
				   randDequeList.pop_front();
		}



now i wanted to write the if statment right into the for loop to save on space but that produces the same error.
101 C:\GameLoop.cpp no match for 'operator<=' in 'iterRandDequeListNeg <= neg.GuessingEngine::negSize' 



any ideas or links to reading material? ive searched the forums and came up empty thus far.

Is This A Good Question/Topic? 0
  • +

Replies To: Deque operator

#2 IngeniousHax  Icon User is offline

  • |>|20-514<|{3|2

Reputation: 78
  • View blog
  • Posts: 1,358
  • Joined: 28-March 09

Re: Deque operator

Posted 23 May 2009 - 11:23 AM

If you're doing this in C++ did you make sure to include all the required default materials such as::
using namespace std;
??
If so than I think a little more code may be needed to troubleshoot your issue.
Was This Post Helpful? 0
  • +
  • -

#3 fx7202  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 09-February 09

Re: Deque operator

Posted 23 May 2009 - 11:38 AM

opps silly me, i forgot to add the * to the iterator in the if statement

if(*iterRandDequeListNeg <= neg.negSize)
								  randDequeList.pop_front();



well we'll see if this makes the program work when i add this to main
thanks
Was This Post Helpful? 0
  • +
  • -

#4 Elcric  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 101
  • View blog
  • Posts: 453
  • Joined: 02-May 09

Re: Deque operator

Posted 23 May 2009 - 11:50 AM

:D Hello everyone!

You might want to look at the DIC C++ Deque Tutorial it has a lot of information that could help you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1