From c860d74cba7def51c7628d89e34b5a51f5d7ea6b Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sun, 29 Sep 2002 16:17:52 +0000 Subject: [PATCH] doc update [SVN r15549] --- doc/v2/copy_const_reference.html | 74 ++++++++++++++++------------ doc/v2/copy_non_const_reference.html | 70 +++++++++++++++----------- 2 files changed, 84 insertions(+), 60 deletions(-) diff --git a/doc/v2/copy_const_reference.html b/doc/v2/copy_const_reference.html index 70da135b..e8d02503 100644 --- a/doc/v2/copy_const_reference.html +++ b/doc/v2/copy_const_reference.html @@ -1,46 +1,58 @@ - + + + + - Boost.Python - <boost/python/copy_const_reference.hpp> + Boost.Python - + <boost/python/copy_const_reference.hpp> + + +
-

-

+

C++ Boost

+

Boost.Python

Header <boost/python/copy_const_reference.hpp>

+

Contents

-
Classes +
Classes
Class - copy_const_reference + copy_const_reference
Class - copy_const_reference synopsis + copy_const_reference synopsis
Class - copy_const_reference metafunctions + copy_const_reference metafunctions
+
+
-
Example +
Example

@@ -50,9 +62,10 @@ copy_const_reference

copy_const_reference is a model of ResultConverterGenerator which can be - used to wrap C++ functions returning a reference-to-const type such that - the referenced value is copied into a new Python object. + "ResultConverter.html#ResultConverterGenerator-concept">ResultConverterGenerator + which can be used to wrap C++ functions returning a reference-to-const + type such that the referenced value is copied into a new Python + object.

Class copy_const_reference synopsis

@@ -73,17 +86,17 @@ template <class T> struct apply
-
Requires: T is U const& for some - U. +
Requires: T is U const& for + some U.
Returns: typedef to_python_value<T> - type; + type;

Example

-

C++ Module Definition

+

C++ Module Definition

 #include <boost/python/module.hpp>
 #include <boost/python/class.hpp>
@@ -104,20 +117,16 @@ struct Foo {
 using namespace boost::python;
 BOOST_PYTHON_MODULE_INIT(my_module)
 {
-   module m("my_module")
-      .add(
-         class_<Bar>()
-         )
-      .add(
-         class_<Foo>()
-            .def_init(args<int>())
-            .def("get_bar", &Foo::get_bar
-                , return_value_policy<copy_const_reference>())
-         )
+    class_<Bar>("Bar");
+
+     class_<Foo>("Foo", init<int>())
+        .def("get_bar", &Foo::get_bar
+            , return_value_policy<copy_const_reference>())
        ;
 }
 
-

Python Code

+ +

Python Code

 >>> from my_module import *
 >>> f = Foo(3)         # create a Foo object
@@ -126,10 +135,13 @@ BOOST_PYTHON_MODULE_INIT(my_module)
 
     

Revised - 15 February, 2002 + 29 September, 2002 +

- -

© Copyright Dave - Abrahams 2002. All Rights Reserved. +

© Copyright Dave Abrahams 2002. All Rights + Reserved.

+ + diff --git a/doc/v2/copy_non_const_reference.html b/doc/v2/copy_non_const_reference.html index ffa728db..8f427016 100644 --- a/doc/v2/copy_non_const_reference.html +++ b/doc/v2/copy_non_const_reference.html @@ -1,47 +1,59 @@ - + + + + Boost.Python - <boost/python/copy_non_const_reference.hpp> + + +
-

-

+

C++ Boost

+

Boost.Python

Header <boost/python/copy_non_const_reference.hpp>

+

Contents

-
Classes +
Classes
Class - copy_non_const_reference + copy_non_const_reference
Class - copy_non_const_reference synopsis + copy_non_const_reference synopsis
-
Class - copy_non_const_reference metafunctions +
Class + copy_non_const_reference metafunctions
+
+
-
Example +
Example

@@ -51,9 +63,10 @@ copy_non_const_reference

copy_non_const_reference is a model of ResultConverterGenerator which can be - used to wrap C++ functions returning a reference-to-non-const type such - that the referenced value is copied into a new Python object. + "ResultConverter.html#ResultConverterGenerator-concept">ResultConverterGenerator + which can be used to wrap C++ functions returning a + reference-to-non-const type such that the referenced value is copied into + a new Python object.

Class copy_non_const_reference synopsis

@@ -75,16 +88,16 @@ template <class T> struct apply
Requires: T is U& for some - non-const U. + non-const U.
Returns: typedef to_python_value<T> - type; + type;

Example

-

C++ code: +

C++ code:

 #include <boost/python/module.hpp>
 #include <boost/python/class.hpp>
@@ -105,16 +118,12 @@ struct Foo {
 using namespace boost::python;
 BOOST_PYTHON_MODULE_INIT(my_module)
 {
-   module("my_module")
-      .add(
-         class_<Bar>()
-         )
-      .add(
-         class_<Foo>()
-            .def_init(args<int>())
-            .def("get_bar", &Foo::get_bar
-                , return_value_policy<copy_non_const_reference>())
-         );
+    class_<Bar>("Bar");
+
+     class_<Foo>("Foo", init<int>())
+        .def("get_bar", &Foo::get_bar
+            , return_value_policy<copy_non_const_reference>())
+       ;
 }
 
Python Code: @@ -126,10 +135,13 @@ BOOST_PYTHON_MODULE_INIT(my_module)

Revised - 05 November, 2001 + 29 September, 2001 +

- -

© Copyright Dave - Abrahams 2002. All Rights Reserved. +

© Copyright Dave Abrahams 2002. All Rights + Reserved.

+ +