Boost logo

Boost :

From: Daryle Walker (dwalker07_at_[hidden])
Date: 2002-11-17 11:45:11


I don't know anything about Boost.Function except what I've seen
checking out the sample documentations. I have some thoughts on the ==
and != operators.

You have poisoned (in)equality operators, because of your safe_bool
type. Are you using a data pointer type, like "void *" that the
IOStreams use for their safe-Boolean type? If so, you should switch to
an even more useless type. I used member-pointers for my modulo class
template (in the Sandbox).

template < int N >
class modulo
{
     typename modulo self_type;

     int r_;

public:
     typename int self_type::* safe_bool;

     operator safe_bool() const;
     //...
};

Here, I used a safe_bool type that was based on the particular version
of the class template, preventing cross-version comparisons. I have a
valid (in)equality operators; if you don't want that either, then
provide declarations for those operators as member functions, but make
them private.

Daryle


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