【发布时间】:2015-08-21 03:59:37
【问题描述】:
有没有办法像python风格一样在C++中装饰函数或方法?
@decorator
def decorated(self, *args, **kwargs):
pass
以宏为例:
DECORATE(decorator_method)
int decorated(int a, float b = 0)
{
return 0;
}
或
DECORATOR_MACRO
void decorated(mytype& a, mytype2* b)
{
}
有可能吗?
【问题讨论】:
标签: c++ function macros decorator