|
Boost : |
Subject: Re: [boost] [safebool] Can we generalize it and put it into utilities?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-04-01 08:32:38
On Tuesday, March 31, 2009 6:07 PM
Vladimir Batov wrote:
> > Stewart, Robert <Robert.Stewart <at> sig.com> writes:
> >
> > > { return safebool<Foo>(c); }
> > > { return safebool<Foo>::apply(c); }
> >
> > The former relies on creating a temporary and accessing a
> nested type,
> > ... The latter involves a static member function, ...
> > It's just a more straightforward mechanism with more consistency
> > between the return type and invocation,
> > together making it slightly nicer.
>
> I actually agree with you... but that's implementation detail
> that the user does
> not care or deal with. As for the interface due to utter
> simplicity of that
> safe_bool I'd like it to be deployable with as little effort
> as possible.
> Therefore, I feel from the *user* point of view the former
> wins over the latter.
That was the point of view from which I was looking, too. I think the following is the easier usage because of the consistency (highlighted, to be sure, by the formatting used here):
struct Foo
{
operator safe_bool<Foo>::type()
{ return safe_bool<Foo>::apply(condition); }
};
This is a valid case to reserve until review in the hopes of getting additional opinions.
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk