Currently, I am reading the source code of Protocol Buffer
, and I found one weird enum
codes defined here
~scoped_ptr() {
enum { type_must_be_complete = sizeof(C) };
delete ptr_;
}
void reset(C* p = NULL) {
if (p != ptr_) {
enum { type_must_be_complete = sizeof(C) };
delete ptr_;
ptr_ = p;
}
}
Why the enum { type_must_be_complete = sizeof(C) };
is defined here? what is it used for?