mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 16:32:16 +00:00
doc update
[SVN r15667]
This commit is contained in:
116
doc/v2/pointee.html
Normal file
116
doc/v2/pointee.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="../boost.css">
|
||||
|
||||
<title>Boost.Python - <boost/python/pointee.hpp></title>
|
||||
|
||||
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
|
||||
"header">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../../index.htm"><img height="86" width="277" alt=
|
||||
"C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
|
||||
|
||||
<td valign="top">
|
||||
<h1 align="center">Boost.Python</h1>
|
||||
|
||||
<h2 align="center">Header <boost/python/pointee.hpp></h2>
|
||||
</table>
|
||||
<hr>
|
||||
|
||||
<h2>Contents</h2>
|
||||
|
||||
<dl class="page-index">
|
||||
<dt><a href="#introduction">Introduction</a>
|
||||
|
||||
<dt><a href="#classes">Classes</a>
|
||||
|
||||
<dd>
|
||||
<dl class="page-index">
|
||||
<dt><a href="#pointee-spec">Class Template<code>pointee</code></a>
|
||||
|
||||
<dd>
|
||||
<dl class="page-index">
|
||||
<dt><a href="#pointee-spec-synopsis">Class Template
|
||||
<code>pointee</code> synopsis</a>
|
||||
</dl>
|
||||
</dl>
|
||||
|
||||
<dt><a href="#examples">Example</a>
|
||||
</dl>
|
||||
<hr>
|
||||
|
||||
<h2><a name="introduction"></a>Introduction</h2>
|
||||
|
||||
<p><code><boost/python/pointee.hpp></code> introduces a
|
||||
traits <a
|
||||
href="../../../mpl/doc/index.html#metafunctions">metafunction</a>
|
||||
template <code>pointee<T></code> which can be used to extract the "pointed-to" type from the type of a pointer or smart pointer.
|
||||
|
||||
<h2><a name="classes"></a>Classes</h2>
|
||||
|
||||
<h3><a name="pointee-spec"></a>Class Template <code>pointee<class T></code></h3>
|
||||
|
||||
<p><code>pointee<T></code> is used by the <code><a
|
||||
href="class.html#class_-spec">class_</a><...></code>
|
||||
template to deduce the type being held when a pointer or smart
|
||||
pointer type is used as its <code>HeldType</code> argument.
|
||||
|
||||
<h4><a name="pointee-spec-synopsis"></a>Class Template
|
||||
<code>pointee</code> synopsis</h4>
|
||||
<pre>
|
||||
namespace boost { namespace python
|
||||
{
|
||||
template <class T> struct pointee
|
||||
{
|
||||
typedef T::element_type type;
|
||||
};
|
||||
|
||||
// specialization for pointers
|
||||
template <T> struct pointee<T*>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
||||
<h2><a name="examples"></a>Example</h2>
|
||||
|
||||
Given a 3rd-party smart pointer type
|
||||
<code>smart_pointer<T></code>, one might partially specialize
|
||||
<code>pointee<smart_pointer<T> ></code> so that it can be
|
||||
used as the <code>HeldType</code> for a class wrapper:
|
||||
|
||||
<pre>
|
||||
#include <boost/python/pointee.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <third_party_lib.hpp>
|
||||
|
||||
namespace boost { namespace python
|
||||
{
|
||||
template <class T> struct pointee<smart_pointer<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
}}
|
||||
|
||||
BOOST_PYTHON_MODULE(pointee_demo)
|
||||
{
|
||||
class_<third_party_class, smart_pointer<third_party_class> >("third_party_class")
|
||||
.def(...)
|
||||
...
|
||||
;
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
03 October, 2002
|
||||
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
|
||||
|
||||
|
||||
<p><i>© Copyright <a href="../../../../people/dave_abrahams.htm">Dave
|
||||
Abrahams</a> 2002. All Rights Reserved.</i>
|
||||
|
||||
Reference in New Issue
Block a user