1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>operator-</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C++ Standard Template Library API Reference" />
10 <link rel="up" href="db_vector_base_iterator.html" title="Chapter 12. Db_vector_base_iterator" />
11 <link rel="prev" href="stldb_vector_base_iteratoroperator_ia.html" title="operator+=" />
12 <link rel="next" href="stldb_vector_base_iteratoroperator_sa.html" title="operator-=" />
15 <div xmlns="" class="navheader">
17 <p>Library Version 11.2.5.3</p>
19 <table width="100%" summary="Navigation header">
21 <th colspan="3" align="center">operator-</th>
24 <td width="20%" align="left"><a accesskey="p" href="stldb_vector_base_iteratoroperator_ia.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 12.
26 Db_vector_base_iterator </th>
27 <td width="20%" align="right"> <a accesskey="n" href="stldb_vector_base_iteratoroperator_sa.html">Next</a></td>
32 <div class="sect1" lang="en" xml:lang="en">
33 <div class="titlepage">
36 <h2 class="title" style="clear: both"><a id="stldb_vector_base_iteratoroperator_sub"></a>operator-</h2>
40 <div class="sect2" lang="en" xml:lang="en">
41 <div class="titlepage">
44 <h3 class="title"><a id="stldb_vector_base_iteratoroperator_sub_details"></a>Function Details</h3>
48 <pre class="programlisting">
49 self operator-(difference_type n) const
51 <p>Iterator movement operator. </p>
52 <p>Return another iterator by moving this iterator backward by n elements. </p>
53 <div class="sect3" lang="en" xml:lang="en">
54 <div class="titlepage">
57 <h4 class="title"><a id="idp765344"></a>Parameters</h4>
61 <div class="sect4" lang="en" xml:lang="en">
62 <div class="titlepage">
65 <h5 class="title"><a id="idp767096"></a>n</h5>
69 <p>The amount and direction of movement. If negative, will move backward by |n| element. </p>
72 <div class="sect3" lang="en" xml:lang="en">
73 <div class="titlepage">
76 <h4 class="title"><a id="idp764200"></a>Return Value</h4>
80 <p>The new iterator at new position. </p>
82 <pre class="programlisting">
83 difference_type operator-(const self &itr) const
85 <p>Iterator distance operator. </p>
86 <p>Return the index difference of this iterator and itr, so if this iterator sits on an element with a smaller index, this call will return a negative number. </p>
87 <div class="sect3" lang="en" xml:lang="en">
88 <div class="titlepage">
91 <h4 class="title"><a id="idp769496"></a>Parameters</h4>
95 <div class="sect4" lang="en" xml:lang="en">
96 <div class="titlepage">
99 <h5 class="title"><a id="idp769688"></a>itr</h5>
103 <p>The other iterator to substract. itr can be the invalid iterator after last element or before first element, their index will be regarded as last element's index + 1 and -1 respectively. </p>
106 <div class="sect3" lang="en" xml:lang="en">
107 <div class="titlepage">
110 <h4 class="title"><a id="idp759008"></a>Return Value</h4>
114 <p>The index difference. </p>
117 <div class="sect2" lang="en" xml:lang="en">
118 <div class="titlepage">
121 <h3 class="title"><a id="idp738736"></a>Group: Iterator movement operators.</h3>
125 <p>When we talk about iterator movement, we think the container is a uni-directional range, represented by [begin, end), and this is true no matter we are using iterators or reverse iterators.</p>
126 <p>When an iterator is moved closer to "begin", we say it is moved forward, otherwise we say it is moved backward. </p>
128 <div class="sect2" lang="en" xml:lang="en">
129 <div class="titlepage">
132 <h3 class="title"><a id="idp763160"></a>Class</h3>
137 <a class="link" href="db_vector_base_iterator.html" title="Chapter 12. Db_vector_base_iterator">db_vector_base_iterator</a>
141 <div class="navfooter">
143 <table width="100%" summary="Navigation footer">
145 <td width="40%" align="left"><a accesskey="p" href="stldb_vector_base_iteratoroperator_ia.html">Prev</a> </td>
146 <td width="20%" align="center">
147 <a accesskey="u" href="db_vector_base_iterator.html">Up</a>
149 <td width="40%" align="right"> <a accesskey="n" href="stldb_vector_base_iteratoroperator_sa.html">Next</a></td>
152 <td width="40%" align="left" valign="top">operator+= </td>
153 <td width="20%" align="center">
154 <a accesskey="h" href="index.html">Home</a>
156 <td width="40%" align="right" valign="top"> operator-=</td>