Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-10-30 07:36:02


Richard Hadsell wrote:
>
> The scoped_ptr and scoped_array classes (and maybe others) have a feature that
> didn't make it into their documentation. In the headers I see operator!() and
> another strange function that purports to offer implicit conversion to bool. It
> would be nice to see them mentioned in the docs.

While we are at it: Where can I find the discussion that resulted in
this code? I tried to search the archive but couldn't find it. It seems
really strange to me how it is done. What is wrong with:

class A
{
private:
   operator int() const;

public:
   operator bool() const { return ...; }

};

as it would make conversions to 'int' illegal and conversions to other
types like 'unsigned int', etc. ambiguous and it is IMHO easier to
understand for users.

Regards, Daniel

--
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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