J
Jonathan Lamothe
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey all. I've got a problem I can't seem to figure out.
I'm writing a program that deals with money in multiple currencies. In
order to define the various currencies, I've created a class called
Currency. I then have a map that looks like this:
std::map<std::string, Currency> currency;
The key to this array is the abbreviation of the currency used, i.e.:
"CAD" = Canadian Dollar, "USD" = U.S. Dollar, etc.
All the data gets loaded from a file. Is there any way to check if a
given key exists within a map so that I could prevent a corrupted file
from creating a segmentation fault by asking for a currency that it
hasn't defined?
- --
Regards,
Jonathan Lamothe
/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/
die_if_kernel("Oops", regs, error_code);
-- From linux/arch/i386/mm/fault.c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEXLntNrv4JaRC3JsRAqdCAKDFSV7DmWVlPBryupJJpyM3pZcCEgCggsJ2
h+8sjJT1T2iyopOTL/hh1Vs=
=Fmeo
-----END PGP SIGNATURE-----
Hash: SHA1
Hey all. I've got a problem I can't seem to figure out.
I'm writing a program that deals with money in multiple currencies. In
order to define the various currencies, I've created a class called
Currency. I then have a map that looks like this:
std::map<std::string, Currency> currency;
The key to this array is the abbreviation of the currency used, i.e.:
"CAD" = Canadian Dollar, "USD" = U.S. Dollar, etc.
All the data gets loaded from a file. Is there any way to check if a
given key exists within a map so that I could prevent a corrupted file
from creating a segmentation fault by asking for a currency that it
hasn't defined?
- --
Regards,
Jonathan Lamothe
/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/
die_if_kernel("Oops", regs, error_code);
-- From linux/arch/i386/mm/fault.c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEXLntNrv4JaRC3JsRAqdCAKDFSV7DmWVlPBryupJJpyM3pZcCEgCggsJ2
h+8sjJT1T2iyopOTL/hh1Vs=
=Fmeo
-----END PGP SIGNATURE-----