Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Organization

Care and attention to detail was given, painstakingly, to the design and implementation of Phoenix.

The library is organized in four layers:

  1. Actor
  2. Value, Reference, Arguments
  3. Function, Operator, Object, Statement, Scope
  4. STL, Fusion, Bind

The modules are orthogonal, with no cyclic dependencies. Lower layers do not depend on higher layers. Modules in a layer do not depend on other modules in the same layer. This means, for example, that Bind can be completely discarded if it is not required; or one could perhaps take out Operator and Statement and just use Function, which may be desirable in a pure FP application.

The library has grown from the original Phoenix but still comprises only header files. There are no object files to link against.

Core

The lowest two layers comprise the core.

The Actor is the main concept behind the library. Lazy functions are abstracted as actors.

Terminals provide the basic building blocks of functionality within Phoenix. Expressions are used to combine these terminals together to provide more powerful functionality.

Expressions are composed of zero or more actors. Each actor in a composite can again be another expression.

Table 1.2. Modules

Module

Description

Function

Lazy functions support (e.g. add)

Operator

Lazy operators support (e.g. +)

Statement

Lazy statements (e.g. if_, while_)

Object

Lazy casts (e.g. static_cast_), object creation destruction (e.g. new_, delete_)

Scope

Support for scopes, local variables and lambda-lambda

Bind

Lazy functions from free functions, member functions or member variables.

STL Container

Set of predefined "lazy" functions that work on STL containers and sequences (e.g. push_back).

STL Algorithm

Set of predefined "lazy" versions of the STL algorithms (e.g. find_if).


Each module is defined in a header file with the same name. For example, the core module is defined in <boost/phoenix/core.hpp>.

Table 1.3. Includes

Module

File

Core

#include <boost/phoenix/core.hpp>

Function

#include <boost/phoenix/function.hpp>

Operator

#include <boost/phoenix/operator.hpp>

Statement

#include <boost/phoenix/statement.hpp>

Object

#include <boost/phoenix/object.hpp>

Scope

#include <boost/phoenix/scope.hpp>

Bind

#include <boost/phoenix/bind.hpp>

Container

#include <boost/phoenix/stl/container.hpp>

Algorithm

#include <boost/phoenix/stl/algorithm.hpp>



PrevUpHomeNext