Boost logo

Boost :

Subject: Re: [boost] [safebool] Can we generalize it and put it into utilities?
From: Vladimir Batov (vladimir.batov_at_[hidden])
Date: 2009-03-30 19:08:36


Based on the suggestions from Steven Watanabe and Robert Stewart I've uploaded
safebool.hpp into the Vault. It can be deployed as

struct Foo
{ ...
   operator safebool<Foo>::type() const { return safebool<Foo>(condition); }
};
or operator safebool<Foo>::type() const { return safebool<Foo>::make(c); }
or operator safebool<Foo>::type() const { return make_safebool<Foo>(c); }

I still like the first one but the other two seemed strong contenders and I
realize they might be marginally faster (in theory anyway).

Documented the need, the usage and the solution.

Best,
V.


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