我希望了解下面的内容fetch().text和assert(0)操作。我不熟悉这样的函数可以引用fetch()返回类型的成员,即fetch().text. 这是否以某种方式通过使用启用assert(0)?
class SimpleS{
struct internal_element {
const char *text;
};
class SimpleE {
public:
SimpleE() {
}
const char* text() const {
return fetch().text;
}
void set_text(const char *text) {
fetch().text = text;
}
private:
internal_element& fetch() const {
... // some code
assert(0);
}
}