namespace Dialog {
enum class Type {Info, Warning, Error};
enum class Buttons {OK, OK_CANCEL, YES_NO, YES_NO_CANCEL};
void Box(Pane* parent, Core::String, Core::String, Buttons, Type);
}
我可以这样定义信息框:
void InfoBox(Core::String title, Core::String text, Buttons b) {
Box(nullptr, title, text, b, Type::Info);
}
,但这种做法我有开销,由于额外的函数调用。
如何减少开销?
这是GUI代码,对吧?你**不会注意到**的开销! – jrok
**从来没有**优化没有分析和测量! –
为什么人们会微观优化 - 而错过更大的图景? –