Re: SourceComment: Is BList::Private needed?

Hi Atul. You’re right! We don’t need the private structs here. I removed them all.

As per out previous discussion the inline declarations should better be removed, right?

I tried to apply your suggestion for

typedef auto_ptr  BItemPointer

. I came across the following issue, maybe someone would have an idea? The thing is that I was about to write the typedef right after the class definition in BItem.h. Then I thought that we would want to declare a BItemPointer when we only have a forward declaration of BItem. We can never have just a forward declaration because BItem and BItemPointer are defined in the same header. I know that in that specific case it may not be too bad not to be able to declare BItemPointer without fully defining BItem as well, but there might be cases where that would matter. One idea would be to define BItemPointer in a separate header but that seems like overkill.

Maybe it is even better to keep the more ugly auto_ptr <> so that we see the places where we should be careful. If I remember correctly, ugliness was one of the major properties of static_cast and the like, so that one can easily see where potentially bad stuff is done.

Let me know what you think.

Attached is an updated patch.

Regards,

Peter

atul wrote:Dear all

What I mean is this Private is just wrapping a QList… and as Private is a struct, is there any need for this struct?

class BList : public BItem
{

. ..

protected:
struct Private
{
QList list;
} p;
};

Why not simply make list a member of BList?

Same comment applies to BInt::Private, etc…

— cheers atul

Would you like to post a relpy?


This post is a reply to:
SourceComment: Is BList::Private needed?
Dear all What I mean is this Private is just wrapping a QList... and as Private is a struct, is there any need for this struct? class BList : public BItem { . .. protected:     (more...)

Follow-ups:
Re: Re: SourceComment: Is BList::Private needed?
Hey Peter Now that these structs are removed, we don't need BDecoder::binaryReader to be dynamically allocated... So BDecoder::BDecoder  (const  QByteArray  &rawData) : binaryReader( rawData, BinaryReader::LittleEndian ) {            p.binaryReader = new BinaryReader (rawData, BinaryReader::LittleEndian (more...)