Original Post
I don''t know if the thread title is accurate enough, so here''s what I want to do:
daerid | Legends | Garage Games | Spirit | Hapy | Boost | Python | Google "Doomed to crumble, unless we grow, and strengthen our communication" - Maynard James Keenan, Tool
#include <iostream>
#include <string>
#include <stdexcept>
struct stack_alloc_error : public std::runtime_error
{
stack_alloc_error() : runtime_error("Stack Allocation not allowed");
};
class SomeClass
{
// What to put here?
};
int main(int argc,char* argv[])
{
try
{
SomeClass* psc = new SomeClass; // <- this should work without error
SomeClass sc; // <- This should throw a stack_alloc_error
}
catch(std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
daerid | Legends | Garage Games | Spirit | Hapy | Boost | Python | Google "Doomed to crumble, unless we grow, and strengthen our communication" - Maynard James Keenan, Tool