What does _currentHandle() mean below?
template<class SpiHandleT>
class SpiHandleIterator : public ISpiHandleIterator<SpiHandleT>
{
public:
SpiHandleIterator() : _currentHandle()
{
}
...
protected:
SpiHandleT _currentHandle;
};
This is known as value-initialization. From the C++03 standard, §8.5/7:
An object whose initializer is an empty set of parentheses, i.e., (), shall be value-initialized.
And from §8.5/5:
To value-initialize an object of type
Tmeans:
- if
Tis a class type with a user-declared constructor, then the default constructor forTis called (and the initialization is ill-formed ifThas no accessible default constructor);- if
Tis a non-union class type without a user-declared constructor, then every non-static data member and base-class component ofTis value-initialized;- if
Tis an array type, then each element is value-initialized;- otherwise, the object is zero-initialized
To zero-initialize an object of type
Tmeans:
- if
Tis a scalar type, the object is set to the value of0(zero) converted toT;- if
Tis a non-union class type, each nonstatic data member and each base-class subobject is zero-initialized;- if
Tis a union type, the object’s first named data member) is zero-initialized;- if
Tis an array type, each element is zero-initialized;- if
Tis a reference type, no initialization is performed.
So in your case, it depends on the definition of SpiHandleT:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With