Boost logo

Boost :

Subject: Re: [boost] std::map::find() wrapper
From: Vicente BOTET (vicente.botet_at_[hidden])
Date: 2011-05-05 18:30:46


> Message du 06/05/11 00:07
> De : "John Bytheway"
> A : boost_at_[hidden]
> Copie à :
> Objet : Re: [boost] std::map::find() wrapper
>
> On 05/05/11 22:55, Vicente BOTET wrote:
> >> Message du 05/05/11 23:50
> >> De : "John Bytheway"
> >> A : boost_at_[hidden]
> >> Copie à :
> >> Objet : Re: [boost] std::map::find() wrapper
> >>
> >> The compiler doesn't have to do a null-check for the reference case, so
> >> it's shorter.
> >
> > I would be interested in knowing why the compiler need to check for 0 when you apply a static_cast?
>
> Because static_cast(b) is valid when b == 0, and must return 0, but
> any non-zero value must be changed (by subtracting 4) because of the
> multiple inheritance. This is a pretty obscure corner case, but it does
> demonstrate that the non-NULL guarantee for references has at least some
> performance implications.

Thanks, I miss the multiple inheritance.

Best,
Vicente


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