Hi Petr,


70 Q_ASSERT (static_cast (byteArray.size()) == Size);
71 // This should never happen at it’s here only to enforce array size
72 // invariant even in release mode.
73 // \todo Keep it or remove?
74 array.resize (Size);

That’s great! Keep it!

114 //! \returns Size of stored array.
115 uint size() const
116 {
117 return Size;
118 }
119
120 //! \returns Size of array that could be stored in this class.
121 static uint arraySize()
122 {
123 return Size;
124 }

Why two functions when

CPPUNIT_ASSERT (array.size() == 11);

works? The compiler will always be able to determine the object type and will know how to call the function. I could be missing something though…

Regards,

Peter

Would you like to post a relpy?


This post starts a thread.
Follow-ups:
Re: FixedSizeArray
Hi Petr, I actually meant that the static function could be called with an object too: CPPUNIT_ASSERT (array.arraySize() == 11); Regards, Peter