Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: question on...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 10 Topic 45739 of 48020
Post > Topic >>

Re: question on map< list<T>::iterator, int>

by Paul Brettschneider <paul.brettschneider@[EMAIL PROTECTED] > May 3, 2008 at 03:21 PM

subramanian100in@[EMAIL PROTECTED]
 India wrote:

> [example code snipped]
> However if I remove the comment, I get compilation error because
> operator '<' is not defined for list<T>::iterator. Why doesn't the
> compiler give this error for
> 'map<list<int>::iterator, int> m;' itself. That is, in this first
> statement inside main() itself, the compiler can know that the less-
> than operator cannot be defined for the key type. So, why does the
> compiler wait for an element to be pushed on to the map to flag the
> error ?

This was discussed not too long ago in a thread named
"Inserting objects into a std::map?":

http://groups.google.com/group/comp.lang.c++/browse_thread/thread/5886d0e5eb5c4a19/a7cf8cbe50d5cd88?lnk=st

When you create a map without ever inserting, why *should* the compiler
complain?
 




 10 Posts in Topic:
question on map< list::iterator, int>
"subramanian100in@[E  2008-05-03 05:48:01 
Re: question on map< list::iterator, int>
=?utf-8?Q?David_C=C3=B4me  2008-05-03 15:06:58 
Re: question on map< list::iterator, int>
Paul Brettschneider <p  2008-05-03 15:21:01 
Re: question on map< list::iterator, int>
Pete Becker <pete@[EMA  2008-05-03 10:08:27 
Re: question on map< list::iterator, int>
andrew.smith.cpp@[EMAIL P  2008-05-03 22:43:55 
Re: question on map< list::iterator, int>
Ian Collins <ian-news@  2008-05-04 17:57:05 
Re: question on map< list::iterator, int>
=?UTF-8?B?RXJpayBXaWtzdHL  2008-05-04 09:07:24 
Re: question on map< list::iterator, int>
andrew.smith.cpp@[EMAIL P  2008-05-04 21:42:27 
Re: question on map< list::iterator, int>
James Kanze <james.kan  2008-05-05 06:03:42 
Re: question on map< list::iterator, int>
James Kanze <james.kan  2008-05-05 06:12:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 8:52:46 CDT 2008.