Hi Atul,
you are totally right about reverse_iterator, I’m using it now. Qt does not seem to have any kind of iterators outside of containers but using the STL is perfectly fine. Committed in revno 78.
Regards,
Peter
atul wrote:Dear Peter,
As for the other case you mentioned, does reverse_iterator ( I think Qt has one ) fits the bill?
–cheerio atul
Peter Dimov wrote:
Hi Atul,
Thanks for the suggestion. It’s always better to use a standard function do the job. The code is simpler and more readable. Let’s use the SourceComment marker as you suggested.
I’ve modified BinaryWriter::writeBytes(), but not BinaryWriter::doWrite() because there is no algorithm, that I know of, that does this:
while (start != end) *--end = *source++;
Similarly with BinaryReader I only modified readBytes() but not doRead(). Further ideas?Regards,
Peter
P.S. Committed in revno 77.
atul wrote:Dear all
Peer code review is critical ( getting somebody else to look at your code works wonders for its quality ;-)
So in addition to what we are doing, take a moment or two and look at some code which you are not working on… and posting those here would work very well
I propose putting a SourceComment: so everybody knows what this is all about ;-)
Okay so here it goes …
char* destination = res.data();
while ( start != end )
*destination++ = *start++;qcopy( start, end, res.data() );
so three lines shrunk to one ;-)
Let me know if I am wrong ( I was inspired by std::copy ;-)
– cheerio atul
