Boost logo

Boost :

From: deansturtevant_at_[hidden]
Date: 2000-12-18 17:51:40


--- In boost_at_[hidden], Jesse Jones <jejones_at_a...> wrote:
> >
> >typedef bool (*assertion_failure_fcn)(void* arg, const char* file,
> >unsigned line, const char* message);
>
> What's arg for?
>
It's a standard technique when defining callbacks. It allows the
client to specify data associated with the callback. Perhaps a
superior approach is:

class assertion_failure_handler
{
 public:
    virtual bool handle_assertion_failure(
        const char* file, unsigned line, const char* message) = 0;
};

void set_assertion_failure_handler(assertion_failure_handler*);

Note that the callback's name is very descriptive. That's my taste,
and comes in useful for classes that derive from multiple bases.


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