<h2>Returns<aclass="headerlink"href="#returns"title="Permalink to this headline">¶</a></h2>
<divclass="line-block">
<divclass="line"><ttclass="docutils literal"><spanclass="pre">make_pair(first,</span><spanclass="pre">first)</span></tt> if [first,last) is empty, otherwise <ttclass="docutils literal"><spanclass="pre">make_pair(m,</span><spanclass="pre">M)</span></tt>, where m is the first iterator in [first,last) such that no iterator in the range refers to a smaller element, and where M is the last iterator in [first,last) such that no iterator in the range refers to a larger element.</div>
</div>
</div>
<divclass="section"id="examples">
<h2>Examples<aclass="headerlink"href="#examples"title="Permalink to this headline">¶</a></h2>
<spanclass="n">static_assert</span><spanclass="p">(</span><spanclass="o">*</span><spanclass="n">result</span><spanclass="p">.</span><spanclass="n">first</span><spanclass="o">==</span><spanclass="mi">1</span><spanclass="p">,</span><spanclass="s">"a min element is 1."</span><spanclass="p">);</span>
<spanclass="n">static_assert</span><spanclass="p">(</span><spanclass="o">*</span><spanclass="n">result</span><spanclass="p">.</span><spanclass="n">second</span><spanclass="o">==</span><spanclass="mi">10</span><spanclass="p">,</span><spanclass="s">"a max element is 10."</span><spanclass="p">);</span>
<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">0</span><spanclass="p">,</span><spanclass="s">"a min element position is 0."</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">9</span><spanclass="p">,</span><spanclass="s">"a max element position is 9."</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">max(floor((3/2)*(N</span><spanclass="pre">-</span><spanclass="pre">1)),</span><spanclass="pre">0)</span></tt> applications of the corresponding predicate, where N is <ttclass="docutils literal"><spanclass="pre">distance(first,</span><spanclass="pre">last)</span></tt>.</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>