This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: small improvement for fill and fill_n


Martin Sebor <sebor@roguewave.com> writes:

  > Paolo Carlini wrote:
  > 
  > > Hi Martin,
  > > 
  > >> IMO, this sounds more like a library issue than a simple matter of
  > >> QoI. It's easily detectable whether the algorithm actually "Assigns
  > >> value through all the iterators..." as the standard specifies or not.
  > >> There are places in the library where the interface goes to extra
  > >> trouble (of using by-value arguments) to avoid this side-effect of
  > >> aliasing.
  > > Thanks for your message: please confirm that I understand well your
  > > point. You mean that the library (i.e., the Standard) should be perhaps
  > > improved in this area to more carefully select a type of argument
  > > passing (e.g., by value) that automatically avoids this kind of trouble?
  > 
  > That would be one way to deal with it but as Nathan says, it may
  > not be the most efficient way. I think it might be best to first
  > approach this as an interpretation request: does the standard intend
  > to require that the reference `value' be used in each iteration of
  > the algorithm or is the implementations suggested by Dan permitted?

An obvious observation: if the standard was to require that the
reference 'value' was to be used in each iteration then the
specializations for "fill"  in stl_algobase.h that use memset for
one-byte types are incorrect. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]