Re: Exception base class
On 24 Mrz., 00:06, sp...@pobox.com (Michael Herstine
<sp...@pobox.com>) wrote:
On 23 Mrz., 00:20, sp...@pobox.com (Michael Herstine
[..]
Yes, I like the suggestion of defining constants of distinct types,
one type for each error code. The problem, of course, is how to tie
those types to enum Code. Am I correct in gathering that your second
suggestion:
template <class>
struct C; // undefined
is that link? So, for instance, to implement the first ctor, one
could write:
my_exception::my_exception( code1_t, const std::string &s1,
const std::string &s2, double x ):
code_( C< code1_t >::x ),
{
what_ = ...;
}
?
Yes, exactly for this purpose was my revised version
of template C - just as a tool used internally to map
the individual tag types to the enum values.
HTH & Greetings from Bremen,
Daniel Kr?gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]