incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Lemings" <Eric.Lemi...@roguewave.com>
Subject RE: [STDCXX-550] Please peer review this change.
Date Mon, 02 Jun 2008 21:35:03 GMT
 

> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Monday, June 02, 2008 2:44 PM
> To: dev@stdcxx.apache.org
> Subject: Re: [STDCXX-550] Please peer review this change.
> 
> Eric Lemings wrote:
> >  
> > Would like to get another set of eyes on this before I submit.
> > 
> > $ svn diff include/deque
> > Index: include/deque
> > ===================================================================
> > --- include/deque       (revision 662487)
> > +++ include/deque       (working copy)
> > @@ -749,7 +749,7 @@
> >      void _C_insert (const iterator &__it,
> >                      _IntType __n, _IntType __x, int) {
> >          // see 23.1.1, p9 and DR 438
> > -        _C_insert_n (__it, __n, __x);
> > +        _C_insert_n (__it, __n, const_reference (__x));
> 
> I suspect this is not correct. Suppose the type of __x is
> a 4 byte int and const_reference is an 8 byte long. The cast
> will make _C_insert_n() to read 4 bytes past the end of __x.
> A better fix might be to cast __x to value_type, as long as
> doing so doesn't violate [sequence.reqmts].

Yep.  Good call.  Will change to value_type() cast.

Brad.

> 
> See also LWG DR 438 for some background:
> http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#438
> 
> Martin
> 

Mime
View raw message