Skip to content

Commit 275704c

Browse files
Daniel Wallinpdimov
authored andcommitted
Doc update.
[SVN r33677]
1 parent 1524a21 commit 275704c

1 file changed

Lines changed: 78 additions & 6 deletions

File tree

doc/python.rst

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
__ ../../../../index.htm
1111

12-
:Authors: David Abrahams, Daniel Wallin
13-
12+
:Authors: Daniel Wallin
13+
1414
:organization: `Boost Consulting`_
1515
:date: $Date$
1616

@@ -67,6 +67,8 @@ For example, the **arity range** of ``mpl::vector2<x,y>`` is 2, the **arity rang
6767
class template ``init``
6868
-----------------------
6969

70+
Defines a named parameter enabled constructor.
71+
7072
.. parsed-literal::
7173
7274
template <class Keywords, class Signature>
@@ -76,15 +78,56 @@ class template ``init``
7678
void def(Class& class\_);
7779
};
7880
79-
:Requires: ``Keywords`` is an MPL sequence of |KeywordsSpec|'s. ``Signature`` is
80-
an MPL sequence with the types of the keyword arguments, in the order dictated
81-
by ``Keywords``.
81+
``init`` requirements
82+
~~~~~~~~~~~~~~~~~~~~~
83+
84+
* ``Keywords`` is a model of |KeywordsSpec|.
85+
* ``Signature`` is an MPL sequence with the types of the keyword arguments,
86+
in the order dictated by ``Keywords``.
87+
* ``Class`` must support these expressions:
88+
89+
======================================================= ==================== ==============================================
90+
Expression Return type Requirements
91+
======================================================= ==================== ==============================================
92+
``Class(a0, ..., aN)`` - ``a0``..\ ``aN`` are tagged arguments.
93+
======================================================= ==================== ==============================================
94+
95+
For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity range** of ``Keywords``.
96+
97+
Example
98+
~~~~~~~
99+
100+
.. parsed-literal::
101+
102+
struct base { /\* ... \*/ };
103+
104+
class X : base
105+
{
106+
public:
107+
BOOST_PARAMETER_CONSTRUCTOR(X, (base),
108+
(required (x, \*))
109+
(optional (y, \*))
110+
)
111+
};
112+
113+
BOOST_PYTHON_MODULE(..)
114+
{
115+
class_<X>("X")
116+
.def(
117+
init<
118+
, mpl::vector2<tag::x, tag::y\*>
119+
, mpl::vector2<int, int>
120+
>()
121+
);
122+
}
82123
83124
------------------------------------------------------------------------------
84125

85126
class template ``call``
86127
-----------------------
87128

129+
Defines a ``__call__`` operator, mapped to ``operator()`` in C++.
130+
88131
.. parsed-literal::
89132
90133
template <class Keywords, class Signature>
@@ -158,6 +201,8 @@ Example
158201
class template ``function``
159202
---------------------------
160203

204+
Defines a named parameter enabled member function.
205+
161206
.. parsed-literal::
162207
163208
template <class Fwd, class Keywords, class Signature>
@@ -233,5 +278,32 @@ of [2,2], so we only need one forwarding overload.
233278
function template ``def``
234279
-------------------------
235280

236-
...
281+
Defines a named parameter enabled free function in the current Python scope.
282+
283+
.. parsed-literal::
284+
285+
template <class Fwd, class Keywords, class Signature>
286+
void def(char const* name);
287+
288+
``def`` requirements
289+
~~~~~~~~~~~~~~~~~~~~
290+
291+
* ``Keywords`` is a model of |KeywordsSpec|.
292+
* ``Signature`` is an MPL sequence with the types of the keyword arguments,
293+
in the order dictated by ``Keywords``, and the return type prepended.
294+
* An instance of ``Fwd`` must support this expression:
295+
296+
======================================================= ==================== ==============================================
297+
Expression Return type Requirements
298+
======================================================= ==================== ==============================================
299+
``fwd(boost::type<R>(), a0, ..., aN)`` Convertible to ``R`` ``a0``..\ ``aN`` are tagged arguments.
300+
======================================================= ==================== ==============================================
301+
302+
For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity range** of ``Keywords``.
303+
304+
305+
Portability
306+
-----------
307+
308+
The Boost.Parameter Python binding library requires *partial template specialization*.
237309

0 commit comments

Comments
 (0)