~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/mpl/doc/src/refmanual/TrivialMetafunction.rst

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
Import upstream version 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.. Metafunctions/Concepts//Trivial Metafunction |70
 
2
 
 
3
Trivial Metafunction
 
4
====================
 
5
 
 
6
Description
 
7
-----------
 
8
 
 
9
A |Trivial Metafunction| accepts a single argument of a class type ``x`` and 
 
10
returns the ``x``\ 's nested type member ``x::name``, where ``name`` is
 
11
a placeholder token for the actual member's name accessed by a specific 
 
12
metafunction's instance. By convention, all `trivial metafunctions`__ in MPL 
 
13
are named after the members they provide assess to. For instance, a |Trivial
 
14
Metafunction| named ``first`` reaches for the ``x``\ 's nested member 
 
15
``::first``.
 
16
 
 
17
__ `Trivial Metafunctions Summary`_
 
18
 
 
19
 
 
20
Expression requirements
 
21
-----------------------
 
22
 
 
23
|In the following table...| ``name`` is placeholder token for the names of 
 
24
the |Trivial Metafunction| itself and the accessed member, and ``x`` is
 
25
a class type such that ``x::name`` is a valid *type-name*.
 
26
 
 
27
+---------------------------+-------------------+---------------------------+
 
28
| Expression                | Type              | Complexity                |
 
29
+===========================+===================+===========================+
 
30
| ``name<x>::type``         | Any type          | Constant time.            |
 
31
+---------------------------+-------------------+---------------------------+
 
32
 
 
33
 
 
34
Expression semantics
 
35
--------------------
 
36
 
 
37
.. parsed-literal::
 
38
 
 
39
    typedef name<x>::type r;
 
40
 
 
41
:Precondition:
 
42
    ``x::name`` is a valid *type-name*.
 
43
 
 
44
:Semantics:
 
45
    ``is_same<r,x::name>::value == true``.
 
46
 
 
47
 
 
48
Models
 
49
------
 
50
 
 
51
* |first|
 
52
* |second|
 
53
* |base|
 
54
 
 
55
 
 
56
See also
 
57
--------
 
58
 
 
59
|Metafunctions|, |Trivial Metafunctions|, |identity|
 
60
 
 
61
 
 
62
.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
 
63
   Distributed under the Boost Software License, Version 1.0. (See accompanying
 
64
   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)