The following article describes how to use a python script to automatically generate the corresponding implementation file. In the initial framework, I personally think it is more convenient to write the class implementation into the class, you can also put the program on google code to facilitate your operations.
The Python script can automatically generate the corresponding implementation file.
After the conversion, the above is the simplest example, which is also applicable to classes and template classes.
-A indicates that the above def function will be automatically converted, and python3.1. h if you do not have the-a option, you need to indicate which functions are to be transferred to the implementation file. The method is as follows to add a redundant one. the H file changes, so. h To. h. bak.
- Syntax of Python Data Types in common collections
- Knowledge about python open-source technology development
- Analysis of specific problems in Python array practice
- How to configure the Python socket Service
- Python logs require constant learning.
In addition, if-t is enabled, it indicates processing the template class. That is, the following information will be added to. h's namesapce method after termination, the implementation of template functions can be directly implemented in. in the H file, I now only support separation, which is clearer.
Well, let's take a look at the instance. I originally implemented all the functions of the template class in. the h class definition is easy to write, but it looks uncomfortable. I hope to separate the implementation part. cc.
Call python3.1 h2cc. py-a-t huff_tr
- int def() ;
-
- {
-
- int x = 3;
-
- }
-
Ee. h generates appropriate huff_tree.cc and modifies huff_tree.h as appropriate. Therefore, all work is automatically completed by h2cc. py. Verify the conversion and use the compilation link.
Of course, there may be unknown bugs in some cases, so you can refer to the copy file. h. bak of the header file for correction.
Original header file