From 275704c8e925ae4571cfdeedc97cbb9b34d33e52 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Wed, 12 Apr 2006 09:39:51 +0000 Subject: [PATCH] Doc update. [SVN r33677] --- doc/python.rst | 84 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/doc/python.rst b/doc/python.rst index a023e4f..4897937 100755 --- a/doc/python.rst +++ b/doc/python.rst @@ -9,8 +9,8 @@ __ ../../../../index.htm -:Authors: David Abrahams, Daniel Wallin -:Contact: dave@boost-consulting.com, dalwan01@student.umu.se +:Authors: Daniel Wallin +:Contact: dalwan01@student.umu.se :organization: `Boost Consulting`_ :date: $Date$ @@ -67,6 +67,8 @@ For example, the **arity range** of ``mpl::vector2`` is 2, the **arity rang class template ``init`` ----------------------- +Defines a named parameter enabled constructor. + .. parsed-literal:: template @@ -76,15 +78,56 @@ class template ``init`` void def(Class& class\_); }; -:Requires: ``Keywords`` is an MPL sequence of |KeywordsSpec|'s. ``Signature`` is - an MPL sequence with the types of the keyword arguments, in the order dictated - by ``Keywords``. +``init`` requirements +~~~~~~~~~~~~~~~~~~~~~ + +* ``Keywords`` is a model of |KeywordsSpec|. +* ``Signature`` is an MPL sequence with the types of the keyword arguments, + in the order dictated by ``Keywords``. +* ``Class`` must support these expressions: + + ======================================================= ==================== ============================================== + Expression Return type Requirements + ======================================================= ==================== ============================================== + ``Class(a0, ..., aN)`` - ``a0``..\ ``aN`` are tagged arguments. + ======================================================= ==================== ============================================== + + For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity range** of ``Keywords``. + +Example +~~~~~~~ + +.. parsed-literal:: + + struct base { /\* ... \*/ }; + + class X : base + { + public: + BOOST_PARAMETER_CONSTRUCTOR(X, (base), + (required (x, \*)) + (optional (y, \*)) + ) + }; + + BOOST_PYTHON_MODULE(..) + { + class_("X") + .def( + init< + , mpl::vector2 + , mpl::vector2 + >() + ); + } ------------------------------------------------------------------------------ class template ``call`` ----------------------- +Defines a ``__call__`` operator, mapped to ``operator()`` in C++. + .. parsed-literal:: template @@ -158,6 +201,8 @@ Example class template ``function`` --------------------------- +Defines a named parameter enabled member function. + .. parsed-literal:: template @@ -233,5 +278,32 @@ of [2,2], so we only need one forwarding overload. function template ``def`` ------------------------- -... +Defines a named parameter enabled free function in the current Python scope. + +.. parsed-literal:: + + template + void def(char const* name); + +``def`` requirements +~~~~~~~~~~~~~~~~~~~~ + +* ``Keywords`` is a model of |KeywordsSpec|. +* ``Signature`` is an MPL sequence with the types of the keyword arguments, + in the order dictated by ``Keywords``, and the return type prepended. +* An instance of ``Fwd`` must support this expression: + + ======================================================= ==================== ============================================== + Expression Return type Requirements + ======================================================= ==================== ============================================== + ``fwd(boost::type(), a0, ..., aN)`` Convertible to ``R`` ``a0``..\ ``aN`` are tagged arguments. + ======================================================= ==================== ============================================== + + For every ``N`` in ``[U,V]``, where ``[U,V]`` is the **arity range** of ``Keywords``. + + +Portability +----------- + +The Boost.Parameter Python binding library requires *partial template specialization*.