Re: SourceComment: Why do we need QueryRoutingTable::Data?

Peter> The second aims at reducing dependencies of header files  because these dependencies propagate quite fast

Do you mean to use the Pimpl idiom? However, pimp has significantly more dynamic memory allocations. We could as well use the Fast Pimpl, IMO.

Peter> It doesn’t make much of a difference if we use m_member or member_ or p->member. It is all just about taste – I don’t like m_member and prefer p->member to member_ (although I find both are fine).

Actually, it does from a readability point of view. Given a method code to reason about you can easily see the members this way. I don’t understand the p->member part though. I was advocating using m_num or num_ instead of num, everywhere in the source code.

Peter> I personally feel that for this case there are no significant advantages of using Data vs. normal members

IMO the advantage is readability. A class and its members is looks natural. If we throw in an indirection, there should be some payback. If and when we need the Counted semantics, we can always put back the indirection.

— cheerio atul

Would you like to post a relpy?


This post is a reply to:
Re: SourceComment: Why do we need QueryRoutingTable::Data?
Hi Atul, In general, there are two main reasons for doing this: to be able to implement reference counting easily and to hide the implementation in the cpp file. The (more...)

Follow-ups:
Re: SourceComment: Why do we need QueryRoutingTable::Data?
Dear Atul, I didn’t know it’s called the pimpl idiom but that’s what I was referring to with p->member (p is the pointer to the Private data). Here is what I (more...)