In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
FC_REFLECT reflection Macro tutorial 1. Background knowledge 1.1. Metalanguage and target language
Target language: a programming language that describes the final execution of a task.
Metalanguage: because the target language itself is a computer program, meta-language is a language that describes all or part of the grammatical rules of the target language.
In addition to engaging in compiler development, it is necessary to separate the meta-language from the target language, in most cases, the meta-language and the target language use the same programming language, which is easy to be confused in concept, which makes it difficult to understand the meta-language.
In C++, templates and macros are actually metalanguages.
1.2. Calculation Quadrant in Compiler Task
For most programming languages, including C++, there are four computational quadrants in the process of compiling and running
First quadrant: calculation of execution period
Second quadrant: compile-time calculation
The third quadrant: heterogeneous numerical computation
The fourth quadrant: type derivation calculation
The calculation that takes place in the first quadrant is easier to understand because it is the ultimate goal for every developer to write code.
The calculation that takes place in the second quadrant mainly includes some numerical optimizations, such as defining int axiom 2: 3; then when the first quadrant is compiled, the result is int axiom 5; where 2: 3 calculates the result directly during compilation, which is often called constant folding.
The third and fourth computational quadrants are usually abstract and related to the deduction of the template, so it is difficult to understand.
The computation that takes place in the third quadrant, called heterogeneous computing, uses different types of container objects that can be stored, such as tuple in C++. In addition, the functions used are also heterogeneous functions, which is a complex way to discuss template functions. The main thing used for this type of calculation is boost::fusion, as shown in the following example:
Auto to_string= [] (auto t) {std::stringstream ss; ss
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.