Sophie

Sophie

distrib > Mageia > 5 > x86_64 > by-pkgid > 0f59c43d821902385f0623255621244d > files > 32

aspell-manual-0.60.6.1-8.mga5.x86_64.rpm

<html lang="en">
<head>
<title>Smart Pointers - Aspell Developer's Manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Aspell spell checker developer's manual.">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Strings.html#Strings" title="Strings">
<link rel="next" href="I_002fO.html#I_002fO" title="I/O">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This is the developer's manual for Aspell.

Copyright (C) 2002, 2003, 2004, 2006 Kevin Atkinson.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.1 or any later version published by the Free Software
     Foundation; with no Invariant Sections, no Front-Cover Texts and
     no Back-Cover Texts.  A copy of the license is included in the
     section entitled "GNU Free Documentation License".
   -->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Smart-Pointers"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="I_002fO.html#I_002fO">I/O</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Strings.html#Strings">Strings</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">8 Smart Pointers</h2>

<p>Smart pointers are used extensively in Aspell to
simplify memory management tasks and to avoid memory leaks.

<h3 class="section">8.1 CopyPtr</h3>

<p>The <code>CopyPtr</code> class makes a deep copy of an object whenever it is
copied.  The <code>CopyPtr</code> class is defined in <samp><span class="file">copy_ptr.hpp</span></samp>. 
This header should be included wherever <code>CopyPtr</code> is used.  The
complete definition of the object <code>CopyPtr</code> is pointing to does
not need to be defined at this point.  The implementation is defined
in <samp><span class="file">copy_ptr-t.hpp</span></samp>.  The implementation header file should be
included at a point in your code where the class <code>CopyPtr</code> is
pointing to is completely defined.

<h3 class="section">8.2 ClonePtr</h3>

<p><code>ClonePtr</code> is like copy pointer except the <code>clone()</code> method
is used instead of the copy constructor to make copies of an object. 
If is defined in <samp><span class="file">clone_ptr.hpp</span></samp> and implemented in
<samp><span class="file">clone_ptr-t.hpp</span></samp>.

<h3 class="section">8.3 StackPtr</h3>

<p>A <code>StackPtr</code> is designed to be used whenever the only pointer to
a new object allocated with <samp><span class="command">new</span></samp> is on the stack.  It is
similar to the standard C++ <code>auto_ptr</code> but the semantics are a
bit different.  It is defined in <samp><span class="file">stack_ptr.hpp</span></samp> &mdash; unlike
<code>CopyPtr</code> or <code>ClonePtr</code> it is defined and implemented in
this header file.

<h3 class="section">8.4 GenericCopyPtr</h3>

<p>A generalized version of <code>CopyPtr</code> and <code>ClonePtr</code> which the
two are based on.  It is defined in <samp><span class="file">generic_copy_ptr.hpp</span></samp> and
implemented in <samp><span class="file">generic_copy_ptr-t.hpp</span></samp>.

   </body></html>