Boost logo

Boost :

From: Geurt Vos (G.Vos_at_[hidden])
Date: 2001-04-10 07:48:24

> This is an unfortunate side effect :(. The operator bool vs. operator
> void* debate has been brought up many times, and I am still not fully
> on how it should be handled.
> Perhaps the best way is just to use operator
> bool but with many dead-end declarations so that the user cannot use any
> the operators, i.e.,
> template<...>
> bool operator==(const any_function<...>&, const any_function<...>&);

As I come to think of it, why not use the 'Modern C++ Design'
approach (it's where I first saw this one)? It could be
something like:

class C {
    class Tester {
        void operator delete(void *);
    operator Tester *() const
        return (f == 0) ? 0 : &Tester();

    SomeType f;


now 'delete C();' will issue a compile-timer error.


Boost list run by bdawes at, gregod at, cpdaniel at, john at