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


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? In either case, do we (the committee) think that the existing text is sufficiently clear to answer the question? (FWIW, I don't think it is, otherwise we wouldn't be having this discussion :-)

Martin


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