Redefinition of macro
When I was writing macros, I wondered whether I can overload macros. According to my C++ knowledge, you can’t. But I still hope I can do so, so I give it a try:
extern template
When you are compiling a header full of template in different places and they share the same instantation parameters, you’ll waste a lot of time compiling them. Luckily, c++11 introduce “extern template” to solve this problem.
pointer to member functions and variables
pointer to member functions
memory layout
The memory layout of member function pointers is actually a bit different from an ordinary pointer :
- The size of it is twice as an ordinary function pointer.
- And what it stores is quite different, too. When I store a normal member function in it, the first 8 bytes(a 64-bit machine) seems to be the address of that member function.
-
- When a virtual member function is stored in it, it actually holds 0x1, 0, which can’t be the address of the function.
- So I guess that, the it might be stored as if it’s a member variable pointer, it holds the offset of it, not the absolute
- address. I defined a derived class from it and overload the virtual function, and what the pointer of it holds 0x0, 0.
The source file for testing the features above
operator specifer, not just a name.
When I was trying to write the following code:
## cannot concat anything
related post: operator_specifier, not just a name, this post is about a question raised from it.
You're up and running!
Next you can update your site name, avatar and other options using the _config.yml file in the root of your repository (shown below).