3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>includes</title>
5 <link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0">
8 <link rel="up" href="../set.html" title="Set algorithms">
9 <link rel="prev" href="../set.html" title="Set algorithms">
10 <link rel="next" href="set_union.html" title="set_union">
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>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../set.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../set.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="set_union.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h5 class="title">
27 <a name="range.reference.algorithms.set.includes"></a><a class="link" href="includes.html" title="includes">includes</a>
28 </h5></div></div></div>
30 <a name="range.reference.algorithms.set.includes.h0"></a>
31 <span class="phrase"><a name="range.reference.algorithms.set.includes.prototype"></a></span><a class="link" href="includes.html#range.reference.algorithms.set.includes.prototype">Prototype</a>
35 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">SinglePassRange1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">SinglePassRange2</span><span class="special">></span>
36 <span class="keyword">bool</span> <span class="identifier">includes</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange1</span><span class="special">&</span> <span class="identifier">rng1</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">SinglePassRange2</span><span class="special">&</span> <span class="identifier">rng2</span><span class="special">);</span>
38 <span class="keyword">template</span><span class="special"><</span>
39 <span class="keyword">class</span> <span class="identifier">SinglePassRange1</span><span class="special">,</span>
40 <span class="keyword">class</span> <span class="identifier">SinglePassRange2</span><span class="special">,</span>
41 <span class="keyword">class</span> <span class="identifier">BinaryPredicate</span>
42 <span class="special">></span>
43 <span class="keyword">bool</span> <span class="identifier">includes</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange1</span><span class="special">&</span> <span class="identifier">rng1</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">SinglePassRange2</span><span class="special">&</span> <span class="identifier">rng2</span><span class="special">,</span>
44 <span class="identifier">BinaryPredicate</span> <span class="identifier">pred</span><span class="special">);</span>
49 <a name="range.reference.algorithms.set.includes.h1"></a>
50 <span class="phrase"><a name="range.reference.algorithms.set.includes.description"></a></span><a class="link" href="includes.html#range.reference.algorithms.set.includes.description">Description</a>
53 <code class="computeroutput"><span class="identifier">includes</span></code> returns <code class="computeroutput"><span class="keyword">true</span></code> if and only if, for every element
54 in <code class="computeroutput"><span class="identifier">rng2</span></code>, an equivalent
55 element is also present in <code class="computeroutput"><span class="identifier">rng1</span></code>.
56 The ordering relationship is determined by using <code class="computeroutput"><span class="keyword">operator</span><span class="special"><</span></code> in the non-predicate versions, and
57 by evaluating <code class="computeroutput"><span class="identifier">pred</span></code> in
58 the predicate versions.
61 <a name="range.reference.algorithms.set.includes.h2"></a>
62 <span class="phrase"><a name="range.reference.algorithms.set.includes.definition"></a></span><a class="link" href="includes.html#range.reference.algorithms.set.includes.definition">Definition</a>
65 Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">algorithm</span><span class="special">/</span><span class="identifier">set_algorithm</span><span class="special">.</span><span class="identifier">hpp</span></code>
68 <a name="range.reference.algorithms.set.includes.h3"></a>
69 <span class="phrase"><a name="range.reference.algorithms.set.includes.requirements"></a></span><a class="link" href="includes.html#range.reference.algorithms.set.includes.requirements">Requirements</a>
72 <span class="bold"><strong>For the non-predicate versions:</strong></span>
74 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
76 <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
77 is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
78 Pass Range</a> Concept.
81 <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
82 is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
83 Pass Range</a> Concept.
86 <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
87 and <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
88 have the same value type.
91 <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>'s
92 value type is a model of the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>.
95 <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>'s
96 value type is a model of the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>.
99 The ordering of objects of type <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>'s
100 value type is a <span class="bold"><strong><span class="emphasis"><em>strict weak ordering</em></span></strong></span>,
101 as defined in the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>
104 <li class="listitem">
105 The ordering of objects of type <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>'s
106 value type is a <span class="bold"><strong><span class="emphasis"><em>strict weak ordering</em></span></strong></span>,
107 as defined in the <code class="computeroutput"><span class="identifier">LessThanComparableConcept</span></code>
112 <span class="bold"><strong>For the predicate versions:</strong></span>
114 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
115 <li class="listitem">
116 <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
117 is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
118 Pass Range</a> Concept.
120 <li class="listitem">
121 <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
122 is a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
123 Pass Range</a> Concept.
125 <li class="listitem">
126 <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
127 and <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
128 have the same value type.
130 <li class="listitem">
131 <code class="computeroutput"><span class="identifier">BinaryPredicate</span></code> is
132 a model of the <code class="computeroutput"><span class="identifier">StrictWeakOrderingConcept</span></code>.
134 <li class="listitem">
135 <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>'s
136 value type is convertible to <code class="computeroutput"><span class="identifier">BinaryPredicate</span></code>'s
139 <li class="listitem">
140 <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>'s
141 value type is convertible to <code class="computeroutput"><span class="identifier">BinaryPredicate</span></code>'s
142 second argument types.
146 <a name="range.reference.algorithms.set.includes.h4"></a>
147 <span class="phrase"><a name="range.reference.algorithms.set.includes.precondition_"></a></span><a class="link" href="includes.html#range.reference.algorithms.set.includes.precondition_">Precondition:</a>
150 <span class="bold"><strong>For the non-predicate versions:</strong></span>
153 <code class="computeroutput"><span class="identifier">rng1</span></code> and <code class="computeroutput"><span class="identifier">rng2</span></code> are sorted in ascending order
154 according to <code class="computeroutput"><span class="keyword">operator</span><span class="special"><</span></code>.
157 <span class="bold"><strong>For the predicate versions:</strong></span>
160 <code class="computeroutput"><span class="identifier">rng1</span></code> and <code class="computeroutput"><span class="identifier">rng2</span></code> are sorted in ascending order
161 according to <code class="computeroutput"><span class="identifier">pred</span></code>.
164 <a name="range.reference.algorithms.set.includes.h5"></a>
165 <span class="phrase"><a name="range.reference.algorithms.set.includes.complexity"></a></span><a class="link" href="includes.html#range.reference.algorithms.set.includes.complexity">Complexity</a>
168 Linear. <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">N</span><span class="special">)</span></code>,
169 where <code class="computeroutput"><span class="identifier">N</span></code> is <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng1</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng2</span><span class="special">)</span></code>.
172 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
173 <td align="left"></td>
174 <td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen,
176 Distributed under the Boost Software License, Version 1.0. (See accompanying
177 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>)
182 <div class="spirit-nav">
183 <a accesskey="p" href="../set.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../set.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="set_union.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>