using C++11 attributes

前端 未结 2 760
抹茶落季
抹茶落季 2020-12-16 13:14

Could you please explain how to get information from attributes in C++? For example, I want to write C++ to python binding. For this I need to annotate all methods in class

2条回答
  •  一个人的身影
    2020-12-16 13:43

    Attributes (a new C++11 feature) are just a standardized syntax for compiler extensions. To do what you want you would need a compiler with the proper extensions. So far, I don't think any compiler even implements attribute syntax, much less any specific attributes for Python bindings.

    Because they're intended for compiler extensions, there's no standard way of creating your own attributes, like you can with Java annotations or C# attributes. Of course, a compiler could provide this ability as an extension... ;)

提交回复
热议问题