Hello,
I would like to throw an exception when my C++ methods encounter something weird and can't recover. Is it OK to throw a std::string pointer?
Here's what I was looking forward to doing:
void Foo::Bar(){
if(!QueryPerformanceTimer(&m_baz)){
throw new std::String("it's the end of the world!");
}
}
void Foo:Caller(){
try{
this->Bar();// should throw
}catch(std::String* caught){ // not quite sure the syntax is ok here...
std::cout<<"Got "<<caught<<std::endl;
}
}