SourceComment: Removing code duplication in BinaryWriter

Dear all

BinaryWriter has a number of methods that differ only in type.

writeUInt32, writeInt32, writeUInt16 etc..

One C++ idiom is to let the compiler write these versions with template member functions….

          Here is the patch that does this and as a result a lot of repetitive functions get eliminated…

The advantage is if we change some class member from char to int, this change is automatically propogated…. So we do not have to go manually and change things..

Let me know….

— cheers atul

Attached Files:

Would you like to post a relpy?


This post starts a thread.
Follow-ups:
Re: SourceComment: Removing code duplication in BinaryWriter
Dear Atul, I looked into your patch and I see two issues with using the template function. The major one is that the template function would allow one to write something like: Ping (more...)