* Dmitry Prokoptsev:
Quote:
>
template<class Self, class Baseclass ExceptionImpl: public Base {
public:
typedef ExceptionImpl<Self, BaseImpl;
>
void raise() { throw *this; }
template<class AExceptionImpl(A a): Base(a) {}
// ExceptionImpl(const Self& self): Base(self) {}
};
>
If I uncomment the commented constructor in ExceptionImpl,
ConcreteError::ConcreteError() stops to be recursive,
The main /technical/ problem here seems to lie in 'throw *this', which
invokes the ExceptionImpl copy constructor (instantiation of
ExceptionImpl). In the case where Base is abstract and causes
ExceptionImpl to be abstract, you're not permitted to instantiate
ExceptionImpl. You can't instantiate an abstract class.
More generally, I don't think this design is good.
Start by deriving from std::runtime_error, and forget the template
stuff; at least make a non-template version work first.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?