diff --git a/doc/html/python.html b/doc/html/python.html
index 20fcdd2..5e26f13 100644
--- a/doc/html/python.html
+++ b/doc/html/python.html
@@ -7,7 +7,7 @@
| Copyright: |
Copyright David Abrahams, Daniel Wallin
2005. Distributed under the Boost Software License,
@@ -42,19 +42,19 @@ functions, operators and constructors to Python.
-
+
boost/parameter/python.hpp introduces a group of def_visitors that can
be used to easily expose Boost.Parameter-enabled member functions to Python with
Boost.Python. It also provides a function template def() that can be used
@@ -81,7 +81,7 @@ We will take a closer look at how this is done in the tutorial section below.
-
+
In this section we will outline the steps needed to bind a simple
Boost.Parameter-enabled member function to Python. Knowledge of the
Boost.Parameter macros are required to understand this section.
@@ -124,7 +124,8 @@ Python we use the binding utility boost::parameter::python::function is a def_visitor that we'll instantiate
and pass to boost::python::class_::def().
To use boost::parameter::python::function we first need to define
-a class with forwarding overloads.
+a class with forwarding overloads. This is needed because window::open()
+is a function template, so we can't refer to it in any other way.
struct open_fwd
{
@@ -188,7 +189,9 @@ forwarding overloads that we defined earlier. The second one is an tag::width* and
tag::height* means that the parameter is optional. The first element of
-the MPL Sequence is the return type of the function, in this case void.
+the MPL Sequence is the return type of the function, in this case void,
+which is passed as the first argument to operator() in the forwarding
+class.
-
+
A ParameterSpec is a function type K(T) that describes both the keyword tag,
K, and the argument type, T, for a parameter.
K is either:
@@ -261,11 +264,12 @@ the arity range of mpl::vector2<x(int),y**(int)> is [1,2].
-
+
Sometimes it is desirable to have a default value for a parameter that differ
in type from the parameter. This technique is useful for doing simple tag-dispatching
-based on the presence of a parameter. An example of this is given in the Boost.Parameter
-docs. The example uses a different technique, but could also have been written like this:
+based on the presence of a parameter. For example:
+
namespace core
{
@@ -313,19 +317,21 @@ int main()
depth_first_search(params()(color = 0));
}''') -->
+
In the above example the type of the default for color is mpl::false_, a
type that is distinct from any color map that the user might supply.
When binding the case outlined above, the default type for color will not
be convertible to the parameter type. Therefore we need to tag the color
-keyword as a special keyword. By doing this we tell the binding functions
-that it needs to generate two overloads, one with the color parameter
-present and one without. Had there been two special keywords, four
-overloads would need to be generated. The number of generated overloads is
-equal to 2N, where N is the number of special keywords.
+keyword as a special keyword. This is done by specifying the tag as
+tag::color** when binding the function (see concept ParameterSpec for
+more details on the tagging). By doing this we tell the binding functions that
+it needs to generate two overloads, one with the color parameter present
+and one without. Had there been two special keywords, four overloads would
+need to be generated. The number of generated overloads is equal to 2N, where N is the number of special keywords.
-
+
Defines a named parameter enabled constructor.
template <class ParameterSpecs>
@@ -348,7 +354,7 @@ model of ParameterSpec.
For every N in [U,V], where [U,V] is the arity
range of ParameterSpecs, Class must support these
expressions:
-
+
@@ -382,7 +388,7 @@ expressions:
uses CallPolicies when creating the binding.
-
+
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/preprocessor.hpp>
@@ -441,7 +447,7 @@ assert(args[y | 1] == 1);
-
+
Defines a __call__ operator, mapped to operator() in C++.
template <class ParameterSpecs>
@@ -464,7 +470,7 @@ is the result type of c(…)
Class must support these expressions, where c is an
instance of Class:
-
+
@@ -494,12 +500,12 @@ instance of Class:
-
+
Returns a def_visitor equivalent to *this, except that it
uses CallPolicies when creating the binding.
-
+
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/preprocessor.hpp>
@@ -568,7 +574,7 @@ return 0;
-
+
Defines a named parameter enabled member function.
template <class Fwd, class ParameterSpecs>
@@ -588,7 +594,7 @@ is the result type of c.f(…)
An instance of Fwd must support this expression:
-
+
@@ -620,7 +626,7 @@ are tagged arguments.
-
+
This example exports a member function f(int x, int y = …) to Python. The
sequence of ParameterSpec's mpl::vector2<tag::x(int), tag::y*(int)> has
an arity range of [2,2], so we only need one forwarding overload.
@@ -684,7 +690,7 @@ assert(y == 1);
-
+
Defines a named parameter enabled free function in the current Python scope.
template <class Fwd, class ParameterSpecs>
@@ -699,7 +705,7 @@ except the first models ParameterSpec. The first el
is the result type of f(…), where f is the function.
An instance of Fwd must support this expression:
-
+
@@ -729,7 +735,7 @@ is the result type of f(…)
-
+
This example exports a function f(int x, int y = …) to Python. The
sequence of ParameterSpec's mpl::vector2<tag::x(int), tag::y*(int)> has
an arity range of [2,2], so we only need one forwarding overload.
@@ -766,14 +772,14 @@ BOOST_PYTHON_MODULE(…)
-
+
The Boost.Parameter Python binding library requires partial template
specialization.
diff --git a/doc/python.rst b/doc/python.rst
index 816369a..d70d917 100755
--- a/doc/python.rst
+++ b/doc/python.rst
@@ -132,7 +132,8 @@ Python we use the binding utility ``boost::parameter::python::function``.
and pass to ``boost::python::class_::def()``.
To use ``boost::parameter::python::function`` we first need to define
-a class with forwarding overloads.
+a class with forwarding overloads. This is needed because ``window::open()``
+is a function template, so we can't refer to it in any other way.
::
@@ -204,7 +205,9 @@ forwarding overloads that we defined earlier. The second one is an `MPL
Sequence`_ with the keyword tag types and argument types for the function
specified as function types. The pointer syntax used in ``tag::width*`` and
``tag::height*`` means that the parameter is optional. The first element of
-the `MPL Sequence`_ is the return type of the function, in this case ``void``.
+the `MPL Sequence`_ is the return type of the function, in this case ``void``,
+which is passed as the first argument to ``operator()`` in the forwarding
+class.
.. The
pointer syntax means that the parameter is optional, so in this case
@@ -295,8 +298,10 @@ the **arity range** of ``mpl::vector2`` is ``[2,2]`` and the
Sometimes it is desirable to have a default value for a parameter that differ
in type from the parameter. This technique is useful for doing simple tag-dispatching
-based on the presence of a parameter. An example_ of this is given in the Boost.Parameter
-docs. The example uses a different technique, but could also have been written like this:
+based on the presence of a parameter. For example:
+
+.. An example_ of this is given in the Boost.Parameter
+ docs. The example uses a different technique, but could also have been written like this:
.. parsed-literal::
@@ -351,18 +356,20 @@ docs. The example uses a different technique, but could also have been written l
.. @build()
-.. _example: index.html#dispatching-based-on-the-presence-of-a-default
+.. .. _example: index.html#dispatching-based-on-the-presence-of-a-default
In the above example the type of the default for ``color`` is ``mpl::false_``, a
type that is distinct from any color map that the user might supply.
When binding the case outlined above, the default type for ``color`` will not
be convertible to the parameter type. Therefore we need to tag the ``color``
-keyword as a *special* keyword. By doing this we tell the binding functions
-that it needs to generate two overloads, one with the ``color`` parameter
-present and one without. Had there been two *special* keywords, four
-overloads would need to be generated. The number of generated overloads is
-equal to 2\ :sup:`N`, where ``N`` is the number of *special* keywords.
+keyword as a *special* keyword. This is done by specifying the tag as
+``tag::color**`` when binding the function (see `concept ParameterSpec`_ for
+more details on the tagging). By doing this we tell the binding functions that
+it needs to generate two overloads, one with the ``color`` parameter present
+and one without. Had there been two *special* keywords, four overloads would
+need to be generated. The number of generated overloads is equal to 2\
+:sup:`N`, where ``N`` is the number of *special* keywords.
------------------------------------------------------------------------------
diff --git a/test/basics.cpp b/test/basics.cpp
index 98c333d..e5fb748 100755
--- a/test/basics.cpp
+++ b/test/basics.cpp
@@ -107,6 +107,6 @@ int main()
//f(index = 56, name = 55); // won't compile
- return 0;
+ return boost::report_errors();
}
diff --git a/test/basics.hpp b/test/basics.hpp
index 9407a1c..a2857e0 100755
--- a/test/basics.hpp
+++ b/test/basics.hpp
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
namespace test {
@@ -79,9 +80,9 @@ struct values_t
BOOST_MPL_ASSERT((boost::is_same));
BOOST_MPL_ASSERT((boost::is_same));
#endif
- BOOST_ASSERT(equal(n, n_));
- BOOST_ASSERT(equal(v, v_));
- BOOST_ASSERT(equal(i, i_));
+ BOOST_TEST(equal(n, n_));
+ BOOST_TEST(equal(v, v_));
+ BOOST_TEST(equal(i, i_));
}
Name const& n;
diff --git a/test/preprocessor.cpp b/test/preprocessor.cpp
index ae44e4f..792a1b7 100755
--- a/test/preprocessor.cpp
+++ b/test/preprocessor.cpp
@@ -453,7 +453,7 @@ int main()
, name = S("foo")
);
-#ifndef BOOST_NO_SFINAE
+#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
assert(sfinae("foo") == 1);
assert(sfinae(1) == 0);
diff --git a/test/sfinae.cpp b/test/sfinae.cpp
index c86d336..f017a21 100755
--- a/test/sfinae.cpp
+++ b/test/sfinae.cpp
@@ -9,7 +9,7 @@
#include
#include
-#ifndef BOOST_NO_SFINAE
+#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
# include
# include
#endif
@@ -70,7 +70,7 @@ namespace test
f_impl(args(a0, a1));
}
-#ifndef BOOST_NO_SFINAE
+#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
// On compilers that actually support SFINAE, add another overload
// that is an equally good match and can only be in the overload set
// when the others are not. This tests that the SFINAE is actually
@@ -96,7 +96,7 @@ int main()
f("foo", 3.f);
f(value = 3.f, name = "foo");
-#ifndef BOOST_NO_SFINAE
+#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
BOOST_TEST(f(3, 4) == 0);
#endif
return boost::report_errors();
|
|---|