conventions.qbk

来自「Boost provides free peer-reviewed portab」· QBK 代码 · 共 70 行

QBK
70
字号
[/ / Copyright (c) 2008 Eric Niebler / / Distributed under the Boost Software License, Version 1.0. (See accompanying / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /][/================================][section:naming Naming Conventions][/================================]Proto is a large library and probably quite unlike any library you've usedbefore. Proto uses some consistent naming conventions to make it easier tonavigate, and they're described below.[/================][heading Functions][/================]All of Proto's functions are defined in the `boost::proto` namespace. Forexample, there is a function called `value()` defined in `boost::proto` thataccepts a terminal expression and returns the terminal's value.[/====================][heading Metafunctions][/====================]Proto defines /metafunctions/ that correspond to each of Proto's free functions.The metafunctions are used to compute the functions' return types. All ofProto's metafunctions live in the `boost::proto::result_of` namespace andhave the same name as the functions to which they correspond. For instance,there is a class template `boost::proto::result_of::value<>` that you canuse to compute the return type of the `boost::proto::value()` function.[/=======================][heading Function Objects][/=======================]Proto defines /function object/ equivalents of all of its free functions. (Afunction object is an instance of a class type that defines an `operator()`member function.) All of Proto's function object types are defined in the`boost::proto::functional` namespace and have the same name as theircorresponding free functions. For example, `boost::proto::functional::value`is a class that defines a function object that does the same thing as the`boost::proto::value()` free function.[/===========================][heading Primitive Transforms][/===========================]Proto also defines /primitive transforms/ -- class types that can be usedto compose larger transforms for manipulating expression trees. Many ofProto's free functions have corresponding primitive transforms. These livein the `boost::proto` namespace and their names have a leading underscore.For instance, the transform corresponding to the `value()` function iscalled `boost::proto::_value`.The following table summarizes the discussion above:[table Proto Naming Conventions  [[Entity]           [Example]                            ]  [[Free Function]    [`boost::proto::value()`]            ]  [[Metafunction]     [`boost::proto::result_of::value<>`] ]  [[Function Object]  [`boost::proto::functional::value`]  ]  [[Transform]        [`boost::proto::_value`]             ]][endsect]

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?