Talk About Network

Google





Programming > C - C++ Learning > Re: What except...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 4224 of 4400
Post > Topic >>

Re: What exception does map throw

by Andrew Falanga <af300wsm@[EMAIL PROTECTED] > Jul 29, 2008 at 12:16 PM

On Jul 29, 1:02=A0pm, "Jim Langston" <tazmas...@[EMAIL PROTECTED]
> wrote:
> "Andrew Falanga" <af300...@[EMAIL PROTECTED]
> wrote in message
>
> news:7566a52d-d393-4ddf-b93f-46cd51e69f55@[EMAIL PROTECTED]
>
> > Hi everyone,
>
> > I'm finally writing some code to use a map. =A0I've never used them
> > before so this is exciting. =A0I'm wondering what exception does the
> > map<> container object through if a key requested does not exist in
> > the map? =A0I don't have a good reference for the STL (I'm using my
C++
> > programming book, "Object-Oriented Programming in C++," by Robert
> > LaFore which has already proven inaccurate a few times and doesn't
> > cover in depth the STL). =A0The program I'm writing I definitely want
i=
t
> > to recover if the key isn't found in the map.
>
> AFAIK std::map doesn't throw at all if the key is not found. =A0If you
ar=
e
> using .find() then it will return and iterator pointing to .end(). =A0If
=
you
> are using [] then it will add the element. =A0No throwing involved.

Wow!  I just tried it in a dummy test program and it doesn't throw and
error at all.  This is cool.  I was just assuming that some sort of
error was thrown.  I'm going to have to invest in a good resource book
on the STL.

Thanks again,
Andy
 




 4 Posts in Topic:
What exception does map throw
Andrew Falanga <af300w  2008-07-29 11:29:53 
Re: What exception does map throw
"Jim Langston"   2008-07-29 12:02:47 
Re: What exception does map throw
Andrew Falanga <af300w  2008-07-29 12:16:15 
Re: What exception does map throw
"Daniel T." <  2008-07-29 20:40:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
localhost-V2008-12-19 Thu Jan 8 12:58:15 PST 2009.