boostorg / boostorg/algorithm

variadic min/max/minmax

Offen
#119 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C++
Sterne
131
Forks
117
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello,
for min/max/minmax with multiple parameters there are only functions per std::initializer_list:
https://en.cppreference.com/w/cpp/algorithm/min
https://en.cppreference.com/w/cpp/algorithm/max
https://en.cppreference.com/w/cpp/algorithm/minmax
The parameters are always passed by value and not by reference and the result is also a value. This is a problem with types like std::array, std::string, etc.

Since the compare class cannot be the last function parameter in a variadic implementation (as in the std implementations) another position must be found, possibilities:
- first function parameter: 2 implementations would be needed each, once with compare class and once without. I don't find that useful.
- first template parameter: only one implementation is needed with default template parameter(s).

A simple variadic implementation could look like this:
[minmax_variadic.hpp.txt](https://github.com/boostorg/algorithm/files/11857077/minmax_variadic.hpp.txt)

minmax needs 2 compare classes (each for min and max) - this is more flexible.

thx
Gero

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with the attached minmax_variadic.hpp.txt proposal and inspect the existing min, max, and minmax entry points in Boost.Algorithm. Resolve the comparator parameter design and determine the expected behavior for reference-based arguments and minmax comparisons. Done means the variadic APIs are integrated with the project and their behavior is covered by appropriate tests.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.