Boost logo

Boost :

From: Daryle Walker (dwalker07_at_[hidden])
Date: 2002-11-24 18:13:45


I haven't the read list is a week, so I apologize if responses to
earlier posts have been resolved already.

Someone (I think the serialization author) talked about how he didn't
like the Standard exception philosophy and tried custom classes and
enum values for exceptions instead. I was thinking that the techniques
could be combined.

Instead of this

class my_exception
{
public:
     enum problems { ... };

     //...

     problems whats_up() const;

     //...
};

We could have

class my_exception_base
     : public std::exception
{
public:
     enum problems { ... };

     explicit my_exception_base( problems p );

     virtual const char * what() const;
              problems whats_up() const;
};

template < my_exception_base::problems P >
class my_exception
     : public my_exception_base
{
public:
     my_exception()
         : my_exception_base( P )
         {}
};

Now everyone can be happy.

Daryle


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk