Boost Phoenix (2)

Source: Internet
Author: User
Tags prototype definition

Phoenix library has an elegant design. Its 11 modules are divided into 4 layers. The functions of the modules are completely orthogonal and there is no circular dependency. Low-level modules do not depend on high-level modules, and modules on the same layer do not depend on each other. This means that the user can select the desired module without including the rest.

 

Core

The actor module is located at the bottom layer of the Phoenix Library (the first layer). It is a prototype definition of Phoenix functor and implements the most basic function of functor: heavy-load operator ().
There are two types of actor: primitives and composites. These two modules constitute the second layer of Phoenix library. The first and second layers are called Phoenix's core.

Primitives provides the Phoenix database function "brick", while composites is "cement", which binds bricks to form larger functional blocks.

 

Function module

There are three types of primitives: function, operator, and statement.
Function --- used to support lazy functions (such as add)
Operator --- used to support lazy operators (for example, +)
Statement --- used to support lazy statements (such as if _, while _)
Composites also includes three types: object, scope, and bind.
Object --- supports lazy cast (such as static_cast _) and object creation and destruction (New _ and delete _)
Scope --- supports scope, local variables, and Lambda-Lambda
Bind --- similar to boost: bind, which is used to wrap common functions, member functions, and member variables into lazy Functions

The above six modules are located on the third layer of Phoenix.

 

"Lazy" STL

At the top of Phoenix (Layer 4), there are two modules that mimic STL: container (also known as intrinsic) and algorithm.

The container does not provide the container, but the lazy version of the container's method, such as push_back.
Algorithm is the lazy version of STL algorithm.

 

Include files

Core # include <boost/spirit/home/Phoenix/CORE. HPP>
Function # include <boost/spirit/home/Phoenix/function. HPP>
Operator # include <boost/spirit/home/Phoenix/operator. HPP>
Statement # include <boost/spirit/home/Phoenix/statement. HPP>

Object # include <boost/spirit/home/Phoenix/object. HPP>
Scope # include <boost/spirit/home/Phoenix/scope. HPP>
Bind # include <boost/spirit/home/Phoenix/Bind. HPP>
Container # include <boost/spirit/home/Phoenix/container. HPP>
Algorithm # include <boost/spirit/home/Phoenix/algorithm. HPP>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.