|
8724 | 8724 | \end{itemdecl} |
8725 | 8725 |
|
8726 | 8726 | \begin{itemdescr} |
| 8727 | +\pnum |
| 8728 | +Let \tcode{comp} be \tcode{less\{\}} |
| 8729 | +and \tcode{proj} be \tcode{identity\{\}} |
| 8730 | +for the overloads with no parameters by those names. |
| 8731 | + |
8727 | 8732 | \pnum |
8728 | 8733 | \expects |
8729 | 8734 | For the first form, \tcode{T} meets the |
8730 | 8735 | \oldconcept{LessThanComparable} requirements (\tref{cpp17.lessthancomparable}). |
8731 | 8736 |
|
8732 | 8737 | \pnum |
8733 | | -\returns |
8734 | | -The smaller value. |
8735 | | -Returns the first argument when the arguments are equivalent. |
8736 | | - |
8737 | | -\pnum |
8738 | | -\complexity |
8739 | | -Exactly one comparison and two applications of the projection, if any. |
| 8738 | +\effects |
| 8739 | +Equivalent to: |
| 8740 | +\tcode{return invoke(comp, invoke(proj, b), invoke(proj, a)) ? b : a;} |
8740 | 8741 |
|
8741 | 8742 | \pnum |
8742 | 8743 | \remarks |
|
8763 | 8764 | \end{itemdecl} |
8764 | 8765 |
|
8765 | 8766 | \begin{itemdescr} |
| 8767 | +\pnum |
| 8768 | +Let \tcode{comp} be \tcode{less\{\}} |
| 8769 | +and \tcode{proj} be \tcode{identity\{\}} |
| 8770 | +for the overloads with no parameters by those names. |
| 8771 | + |
8766 | 8772 | \pnum |
8767 | 8773 | \expects |
8768 | 8774 | \tcode{ranges::distance(r) > 0}. |
|
8773 | 8779 |
|
8774 | 8780 | \pnum |
8775 | 8781 | \returns |
8776 | | -The smallest value in the input range. |
8777 | | -Returns a copy of the leftmost element |
8778 | | -when several elements are equivalent to the smallest. |
| 8782 | +Returns a copy of the leftmost element \tcode{e} in the input range \tcode{r} |
| 8783 | +for which \tcode{bool(invoke(comp, invoke(proj, x), invoke(proj, e)))} |
| 8784 | +is \tcode{false} for all elements \tcode{x} in \tcode{r}. |
8779 | 8785 |
|
8780 | 8786 | \pnum |
8781 | 8787 | \complexity |
8782 | 8788 | Exactly \tcode{ranges::distance(r) - 1} comparisons |
8783 | | -and twice as many applications of the projection, if any. |
| 8789 | +and twice as many applications of the projection. |
8784 | 8790 |
|
8785 | 8791 | \pnum |
8786 | 8792 | \remarks |
|
8802 | 8808 | \end{itemdecl} |
8803 | 8809 |
|
8804 | 8810 | \begin{itemdescr} |
| 8811 | +\pnum |
| 8812 | +Let \tcode{comp} be \tcode{less\{\}} |
| 8813 | +and \tcode{proj} be \tcode{identity\{\}} |
| 8814 | +for the overloads with no parameters by those names. |
| 8815 | + |
8805 | 8816 | \pnum |
8806 | 8817 | \expects |
8807 | 8818 | For the first form, \tcode{T} meets the |
8808 | 8819 | \oldconcept{LessThanComparable} requirements (\tref{cpp17.lessthancomparable}). |
8809 | 8820 |
|
8810 | 8821 | \pnum |
8811 | | -\returns |
8812 | | -The larger value. |
8813 | | -Returns the first argument when the arguments are equivalent. |
8814 | | - |
8815 | | -\pnum |
8816 | | -\complexity |
8817 | | -Exactly one comparison and two applications of the projection, if any. |
| 8822 | +\effects |
| 8823 | +Equivalent to: |
| 8824 | +\tcode{return invoke(comp, invoke(proj, a), invoke(proj, b)) ? b : a;} |
8818 | 8825 |
|
8819 | 8826 | \pnum |
8820 | 8827 | \remarks |
|
8841 | 8848 | \end{itemdecl} |
8842 | 8849 |
|
8843 | 8850 | \begin{itemdescr} |
| 8851 | +\pnum |
| 8852 | +Let \tcode{comp} be \tcode{less\{\}} |
| 8853 | +and \tcode{proj} be \tcode{identity\{\}} |
| 8854 | +for the overloads with no parameters by those names. |
| 8855 | + |
8844 | 8856 | \pnum |
8845 | 8857 | \expects |
8846 | 8858 | \tcode{ranges::distance(r) > 0}. |
|
8851 | 8863 |
|
8852 | 8864 | \pnum |
8853 | 8865 | \returns |
8854 | | -The largest value in the input range. |
8855 | | -Returns a copy of the leftmost element |
8856 | | -when several elements are equivalent to the largest. |
| 8866 | +Returns a copy of the leftmost element \tcode{e} in the input range \tcode{r} |
| 8867 | +for which \tcode{bool(invoke(comp, invoke(proj, e), invoke(proj, x)))} |
| 8868 | +is \tcode{false} for all elements \tcode{x} in \tcode{r}. |
8857 | 8869 |
|
8858 | 8870 | \pnum |
8859 | 8871 | \complexity |
8860 | 8872 | Exactly \tcode{ranges::distance(r) - 1} comparisons |
8861 | | -and twice as many applications of the projection, if any. |
| 8873 | +and twice as many applications of the projection. |
8862 | 8874 |
|
8863 | 8875 | \pnum |
8864 | 8876 | \remarks |
|
8882 | 8894 |
|
8883 | 8895 |
|
8884 | 8896 | \begin{itemdescr} |
| 8897 | +\pnum |
| 8898 | +Let \tcode{comp} be \tcode{less\{\}} |
| 8899 | +and \tcode{proj} be \tcode{identity\{\}} |
| 8900 | +for the overloads with no parameters by those names. |
| 8901 | + |
8885 | 8902 | \pnum |
8886 | 8903 | \expects |
8887 | 8904 | For the first form, \tcode{T} meets the |
8888 | 8905 | \oldconcept{LessThanComparable} requirements (\tref{cpp17.lessthancomparable}). |
8889 | 8906 |
|
8890 | 8907 | \pnum |
8891 | 8908 | \returns |
8892 | | -\tcode{\{b, a\}} if \tcode{b} is smaller than \tcode{a}, and |
8893 | | -\tcode{\{a, b\}} otherwise. |
| 8909 | +\tcode{\{b, a\}} if |
| 8910 | +\tcode{bool(invoke(comp, invoke(proj, b), invoke(proj, a)))} is \tcode{true}, |
| 8911 | +and \tcode{\{a, b\}} otherwise. |
8894 | 8912 |
|
8895 | 8913 | \pnum |
8896 | 8914 | \complexity |
8897 | | -Exactly one comparison and two applications of the projection, if any. |
| 8915 | +Exactly one comparison and two applications of the projection. |
8898 | 8916 |
|
8899 | 8917 | \pnum |
8900 | 8918 | \remarks |
|
8922 | 8940 | \end{itemdecl} |
8923 | 8941 |
|
8924 | 8942 | \begin{itemdescr} |
| 8943 | +\pnum |
| 8944 | +Let \tcode{comp} be \tcode{less\{\}} |
| 8945 | +and \tcode{proj} be \tcode{identity\{\}} |
| 8946 | +for the overloads with no parameters by those names. |
| 8947 | + |
8925 | 8948 | \pnum |
8926 | 8949 | \expects |
8927 | 8950 | \tcode{ranges::distance(r) > 0}. |
|
8934 | 8957 | \returns |
8935 | 8958 | Let \tcode{X} be the return type. |
8936 | 8959 | Returns \tcode{X\{x, y\}}, |
8937 | | -where \tcode{x} is a copy of the leftmost element with the smallest value and |
8938 | | -\tcode{y} a copy of the rightmost element with the largest value |
8939 | | -in the input range. |
| 8960 | +where \tcode{x} is a copy of |
| 8961 | +the leftmost element in the input range \tcode{r} for which |
| 8962 | +\tcode{bool(invoke(comp, invoke(proj, e), invoke(proj, x)))} |
| 8963 | +is \tcode{false} for all elements \tcode{e} in \tcode{r} |
| 8964 | +and \tcode{y} is a copy of |
| 8965 | +the rightmost element in \tcode{r} for which |
| 8966 | +\tcode{bool(invoke(comp, invoke(proj, y), invoke(proj, e)))} |
| 8967 | +is \tcode{false} for all elements \tcode{e} in \tcode{r}. |
8940 | 8968 |
|
8941 | 8969 | \pnum |
8942 | 8970 | \complexity |
8943 | | -At most $(3/2)\tcode{ranges::distance(r)}$ applications |
8944 | | -of the corresponding predicate |
8945 | | -and twice as many applications of the projection, if any. |
| 8971 | +At most $(3/2)\tcode{ranges::distance(r)}$ comparisons |
| 8972 | +and twice as many applications of the projection. |
8946 | 8973 |
|
8947 | 8974 | \pnum |
8948 | 8975 | \remarks |
|
0 commit comments