我有很多二传手。有没有一种通用的方法来获取每个 setter 的第一个参数而不拼写每个不同 setter 参数的名称?例如:
void
Class::setSelectedEntryIndex(int newSelectedEntryIndex) {
m_log(ExEr) << "first arg: " << newSelectedEntryIndex << std::endl;
m_selectedEntryIndex = newSelectedEntryIndex;
emit selectedEntryIndexChanged();
}
replaced with:
void
Class::setSelectedEntryIndex(int newSelectedEntryIndex) {
m_log(ExEr) << "first arg: " << this->firstArg << std::endl; // Change here
m_selectedEntryIndex = newSelectedEntryIndex;
emit selectedEntryIndexChanged();
}
?