Custom C++ exception class with stack trace generation
Exception( const char *cmessage ) :


I strongly recommend making this constructor explicit, so that you don't permit the user to accidentally write

void some_function(const Exception&amp;);
...
some_function("hello world");


My impression is that most C++ experts recommend explicit on one-argument constructors; I personally hold the minority opinion that explicit should be present on all constructors by default (i.e., if you don't have a specific immediate need for implicit conversion, you should just put explicit automatically, and sort out the consequences later if necessary).



catch ( std::exception &amp;ex )


My current employer's codebase actually does catch by non-const reference, but if you're starting from scratch, I strongly recommend catching by const reference by default. Accidentally mutating the current exception object can cause race conditions.



Also, in the Exception constructor, your catch (std::exception&amp;) should almost certainly be catch (...), right?



As for the high-level point of what you're doing, I believe I have an outline of this sort of thing under "Mix-Ins" somewhere near the end of Template Normal Programming. (Sorry, I'm rushed right now, but I can come back and give you a real link later.) (LATER: I elided that part of the talk, but the two slides on mixins are visible very briefly here.)

The first improvement is to make your thing a template inheriting from T instead of from std::runtime_error specifically. Second, I'd make a function my::throw_with_stacktrace(T&amp;&amp; ex) that simply does throw Exception&lt;std::remove_reference_t&lt;T&gt;&gt;(std::forward&lt;T&gt;(ex));.

Gotta run, but I hope this helps a bit.