1[/ 2 / Copyright (c) 2008 Eric Niebler 3 / 4 / Distributed under the Boost Software License, Version 1.0. (See accompanying 5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 /] 7 8[/================================] 9[section:naming Naming Conventions] 10[/================================] 11 12Proto is a large library and probably quite unlike any library you've used 13before. Proto uses some consistent naming conventions to make it easier to 14navigate, and they're described below. 15 16[/================] 17[heading Functions] 18[/================] 19 20All of Proto's functions are defined in the `boost::proto` namespace. For 21example, there is a function called `value()` defined in `boost::proto` that 22accepts a terminal expression and returns the terminal's value. 23 24[/====================] 25[heading Metafunctions] 26[/====================] 27 28Proto defines /metafunctions/ that correspond to each of Proto's free functions. 29The metafunctions are used to compute the functions' return types. All of 30Proto's metafunctions live in the `boost::proto::result_of` namespace and 31have the same name as the functions to which they correspond. For instance, 32there is a class template `boost::proto::result_of::value<>` that you can 33use to compute the return type of the `boost::proto::value()` function. 34 35[/=======================] 36[heading Function Objects] 37[/=======================] 38 39Proto defines /function object/ equivalents of all of its free functions. (A 40function object is an instance of a class type that defines an `operator()` 41member function.) All of Proto's function object types are defined in the 42`boost::proto::functional` namespace and have the same name as their 43corresponding free functions. For example, `boost::proto::functional::value` 44is a class that defines a function object that does the same thing as the 45`boost::proto::value()` free function. 46 47[/===========================] 48[heading Primitive Transforms] 49[/===========================] 50 51Proto also defines /primitive transforms/ -- class types that can be used 52to compose larger transforms for manipulating expression trees. Many of 53Proto's free functions have corresponding primitive transforms. These live 54in the `boost::proto` namespace and their names have a leading underscore. 55For instance, the transform corresponding to the `value()` function is 56called `boost::proto::_value`. 57 58The following table summarizes the discussion above: 59 60[table Proto Naming Conventions 61 [[Entity] [Example] ] 62 [[Free Function] [`boost::proto::value()`] ] 63 [[Metafunction] [`boost::proto::result_of::value<>`] ] 64 [[Function Object] [`boost::proto::functional::value`] ] 65 [[Transform] [`boost::proto::_value`] ] 66] 67 68[endsect] 69 70