<h2>Requires<aclass="headerlink"href="#requires"title="Permalink to this headline">¶</a></h2>
<divclass="line-block">
<divclass="line">The elements e of [first,last) shall be partitioned with respect to the expressions <ttclass="docutils literal"><spanclass="pre">e</span><spanclass="pre"><</span><spanclass="pre">value</span></tt> and <ttclass="docutils literal"><spanclass="pre">!(value</span><spanclass="pre"><</span><spanclass="pre">e)</span></tt> or <ttclass="docutils literal"><spanclass="pre">comp(e,</span><spanclass="pre">value)</span></tt> and <ttclass="docutils literal"><spanclass="pre">!comp(value,</span><spanclass="pre">e)</span></tt>.</div>
<divclass="line">Also, for all elements e of [first, last), <ttclass="docutils literal"><spanclass="pre">e</span><spanclass="pre"><</span><spanclass="pre">value</span></tt> shall imply <ttclass="docutils literal"><spanclass="pre">!(value</span><spanclass="pre"><</span><spanclass="pre">e)</span></tt> or <ttclass="docutils literal"><spanclass="pre">comp(e,</span><spanclass="pre">value)</span></tt> shall imply <ttclass="docutils literal"><spanclass="pre">!comp(value,</span><spanclass="pre">e)</span></tt>.</div>
</div>
</div>
<divclass="section"id="returns">
<h2>Returns<aclass="headerlink"href="#returns"title="Permalink to this headline">¶</a></h2>
<spanclass="n">static_assert</span><spanclass="p">(</span><spanclass="n">result</span><spanclass="p">.</span><spanclass="n">first</span><spanclass="o">-</span><spanclass="n">begin</span><spanclass="p">(</span><spanclass="n">input</span><spanclass="p">)</span><spanclass="o">==</span><spanclass="mi">3</span><spanclass="p">,</span><spanclass="s">"a lower bound position is 3."</span><spanclass="p">);</span>
<spanclass="n">static_assert</span><spanclass="p">(</span><spanclass="n">result</span><spanclass="p">.</span><spanclass="n">second</span><spanclass="o">-</span><spanclass="n">begin</span><spanclass="p">(</span><spanclass="n">input</span><spanclass="p">)</span><spanclass="o">==</span><spanclass="mi">7</span><spanclass="p">,</span><spanclass="s">"a upper bound position is 7."</span><spanclass="p">);</span>
<spanclass="n">static_assert</span><spanclass="p">(</span><spanclass="n">sprout</span><spanclass="o">::</span><spanclass="n">all_of_equal</span><spanclass="p">(</span><spanclass="n">result</span><spanclass="p">.</span><spanclass="n">first</span><spanclass="p">,</span><spanclass="n">result</span><spanclass="p">.</span><spanclass="n">second</span><spanclass="p">.</span><spanclass="mi">5</span><spanclass="p">),</span><spanclass="s">"all of result range is equal to 5."</span><spanclass="p">);</span>
</pre></div>
</div>
</div>
<divclass="section"id="complexity">
<h2>Complexity<aclass="headerlink"href="#complexity"title="Permalink to this headline">¶</a></h2>
<divclass="line-block">
<divclass="line">At most <ttclass="docutils literal"><spanclass="pre">2</span><spanclass="pre">*</span><spanclass="pre">log2(last</span><spanclass="pre">-</span><spanclass="pre">first)</span><spanclass="pre">+</span><spanclass="pre">O(1)</span></tt> comparisons.</div>
<divclass="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
</div>
</div>
<divclass="section"id="header">
<h2>Header<aclass="headerlink"href="#header"title="Permalink to this headline">¶</a></h2>