Topic: String extractor and bad_alloc
Author: Helmut Zeisel <helmut.zeisel@aon.at>
Date: Mon, 1 Oct 2001 21:46:22 GMT Raw View
Consider the following piece of code:
std::string s;
std::cin >> s;
Assume that memory is so low and the string is so long
that a bad_alloc exception occurs during the string input
(e.g. by some string::operator+=() ).
What should the state of std::cin be after the operation?
bad() or fail()?
I did not find any information in 21.3.7.9,
is this covered elsewhere in the standard?
Helmut
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]