Boost logo

Boost :

From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2008-01-10 07:58:35


From: Neal Becker
10 January 2008 12:16 To: boost_at_[hidden]
Subject: Re: [boost] bounded_iterator

> Sounds interesting.
>
> What is the point of unspecified_bool_helper?

It's generally agreed that unspecified_bool_type should be a
pointer-to-member of some class. unspecified_bool_helper is that class.
If you use bounded_iterator as the class, then you have to consider what
the "true" value is going to be. You either have to point at a member
which you have introduced for the purpuse (which adds space overhead),
or you have to point at an existing member - but once you have pointed
at an existing member, then people can return access that member via the
pointer. So if unspecified_bool_helper was declared as:
        typedef base_iterator bounded_iterator::*unspecified_bool_type;
(which avoids the extra helper class), then Machiavelli could write:
        bounded_iterator::*base_iterator pm = it;
        it.*pm = new_end;
I can't immediately see how Murphy could come to grief, but given his
ingenuity, there may be a way. Using unspecified_bool_helper, there
cannot be a problem.

-- 
Martin Bonner
Senior Software Engineer/Team Leader
PI SHURLOK LTD
Telephone: +44 1223 441434 / 203894 (direct)
Fax: +44 1223 203999
Email: martin.bonner_at_[hidden]
www.pi-shurlok.com
disclaimer

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