On Sun, 10 Jan 2010, Ralf Wildenhues wrote:
My main comment is that it would be useful if the thrown class is
derived from std:exception (or one of its standard derived classes)
in order to flush out any issues which may stem from possible
partial template instantiation in libstdc++ (or pre-compiled
headers) as well as in the test translation unit.
OK, sounds useful. Would that entail more than just something like
this incremental addition?
I think that the virtual what() method needs to be provided or else
you have only a partially implemented class:
class MyException : public std::exception
{
public;
MyException() {}
virtual const char *what() const throw()
{
return "My message";
}
};
But this is a better class to test with since it uses more standard
library stuff and is therefore more likely to fail if something is
wrong:
#include <exception>
#include <string>
class MyException : public std::exception
{
public;
MyException(std::string str)
: message(str)
{
}
virtual const char *what() const throw()
{
return message.c_str();
}
private:
std::string message;
};
Which can be thrown with
throw MyException("My message");
Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/