In C++, calling Object::write() will initialize any child objects if not already done explicitly, but calling Object::bitSizeOf() does not.
For objects that need to be initialized, the initialization values should be part of the constructor.
Currently, you can create such objects just fine, but when trying to write them using BitStreamWriter, an exception will be thrown.
In C++, calling
Object::write()
will initialize any child objects if not already done explicitly, but callingObject::bitSizeOf()
does not.For objects that need to be initialized, the initialization values should be part of the constructor.
Currently, you can create such objects just fine, but when trying to write them using
BitStreamWriter
, an exception will be thrown.Consider an object:
This code works fine:
but this will throw an exception:
Expected
bitSizeOf
should behave the same way aswrite