1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>begin()</title> 5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../../index.html" title="Chapter 1. Geometry"> 8<link rel="up" href="../boost__geometry__index__rtree.html" title="boost::geometry::index::rtree"> 9<link rel="prev" href="qend__.html" title="qend()"> 10<link rel="next" href="end__.html" title="end()"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="qend__.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__geometry__index__rtree.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="end__.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__"></a><a name="classboost_1_1geometry_1_1index_1_1rtree_1a4efdce77c31a940642d824f3cabe2d31"></a><a class="link" href="begin__.html" title="begin()">begin()</a> 28</h5></div></div></div> 29<p> 30 <a class="indexterm" name="idm45635675516768"></a> 31Returns the iterator pointing at the begin of the rtree values range. 32 </p> 33<h6> 34<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.h0"></a> 35 <span class="phrase"><a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.description"></a></span><a class="link" href="begin__.html#geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.description">Description</a> 36 </h6> 37<p> 38 This method returns the iterator which may be used to iterate over all 39 values stored in the rtree. 40 </p> 41<h6> 42<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.h1"></a> 43 <span class="phrase"><a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.synopsis"></a></span><a class="link" href="begin__.html#geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.synopsis">Synopsis</a> 44 </h6> 45<pre class="programlisting"><code class="literal"><a class="link" href="../boost__geometry__index__rtree.html#classboost_1_1geometry_1_1index_1_1rtree_1a701f65f0d6cf2e8b7be7f1c4b8fb7fde">const_iterator</a></code> <code class="computeroutput"><span class="identifier">begin</span></code><code class="computeroutput"><span class="special">()</span></code> 46</pre> 47<h6> 48<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.h2"></a> 49 <span class="phrase"><a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.modifier_s_"></a></span><a class="link" href="begin__.html#geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.modifier_s_">Modifier(s)</a> 50 </h6> 51<p> 52</p> 53<pre class="programlisting"><span class="keyword">const</span></pre> 54<p> 55 </p> 56<h6> 57<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.h3"></a> 58 <span class="phrase"><a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.returns"></a></span><a class="link" href="begin__.html#geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.returns">Returns</a> 59 </h6> 60<p> 61 The iterator pointing at the begin of the range. 62 </p> 63<h6> 64<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.h4"></a> 65 <span class="phrase"><a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.example"></a></span><a class="link" href="begin__.html#geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.example">Example</a> 66 </h6> 67<p> 68</p> 69<pre class="programlisting"><span class="comment">// Copy all values into the vector</span> 70<span class="identifier">std</span><span class="special">::</span><span class="identifier">copy</span><span class="special">(</span><span class="identifier">tree</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">vec</span><span class="special">));</span> 71 72<span class="keyword">for</span> <span class="special">(</span> <span class="identifier">Rtree</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">it</span> <span class="special">=</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">;</span> <span class="identifier">it</span> <span class="special">!=</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span> <span class="special">;</span> <span class="special">++</span><span class="identifier">it</span> <span class="special">)</span> 73<span class="special">{</span> 74 <span class="comment">// do something with value</span> 75<span class="special">}</span> 76 77<span class="comment">// C++11 (auto)</span> 78<span class="keyword">for</span> <span class="special">(</span> <span class="keyword">auto</span> <span class="identifier">it</span> <span class="special">=</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">;</span> <span class="identifier">it</span> <span class="special">!=</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">end</span><span class="special">()</span> <span class="special">;</span> <span class="special">++</span><span class="identifier">it</span> <span class="special">)</span> 79<span class="special">{</span> 80 <span class="comment">// do something with value</span> 81<span class="special">}</span> 82 83<span class="comment">// C++14 (generic lambda expression)</span> 84<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span><span class="identifier">tree</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">tree</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="special">[](</span><span class="keyword">auto</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">val</span><span class="special">){</span> 85 <span class="comment">// do something with value</span> 86<span class="special">})</span> 87</pre> 88<p> 89 </p> 90<h6> 91<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.h5"></a> 92 <span class="phrase"><a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.iterator_category"></a></span><a class="link" href="begin__.html#geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.iterator_category">Iterator 93 category</a> 94 </h6> 95<p> 96 ForwardIterator 97 </p> 98<h6> 99<a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.h6"></a> 100 <span class="phrase"><a name="geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.throws"></a></span><a class="link" href="begin__.html#geometry.reference.spatial_indexes.boost__geometry__index__rtree.begin__.throws">Throws</a> 101 </h6> 102<p> 103 If allocation throws. 104 </p> 105<div class="warning"><table border="0" summary="Warning"> 106<tr> 107<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../../../../doc/src/images/warning.png"></td> 108<th align="left">Warning</th> 109</tr> 110<tr><td align="left" valign="top"><p> 111 The modification of the rtree may invalidate the iterators. 112 </p></td></tr> 113</table></div> 114</div> 115<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 116<td align="left"></td> 117<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam 118 Wulkiewicz, Oracle and/or its affiliates<p> 119 Distributed under the Boost Software License, Version 1.0. (See accompanying 120 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 121 </p> 122</div></td> 123</tr></table> 124<hr> 125<div class="spirit-nav"> 126<a accesskey="p" href="qend__.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__geometry__index__rtree.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="end__.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 127</div> 128</body> 129</html> 130