Namespaces
Variants

std:: minus<void>

From cppreference.net
Utilities library
Function objects
Function invocation
(C++17) (C++23)
Identity function object
(C++20)
Old binders and adaptors
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
( until C++17* ) ( until C++17* )
( until C++17* ) ( until C++17* )

( until C++17* )
( until C++17* ) ( until C++17* ) ( until C++17* ) ( until C++17* )
( until C++20* )
( until C++20* )
Definiert im Header <functional>
template <>
class minus < void > ;
(seit C++14)

std:: minus < void > ist eine Spezialisierung von std::minus mit abgeleitetem Parameter- und Rückgabetyp.

Inhaltsverzeichnis

Mitgliedertypen

Typ Definition
is_transparent unspecified

Memberfunktionen

operator()
gibt die Differenz zweier Argumente zurück
(öffentliche Elementfunktion)

std::minus<void>:: operator()

template < class T, class U >

constexpr auto operator ( ) ( T && lhs, U && rhs ) const

- > decltype ( std:: forward < T > ( lhs ) - std:: forward < U > ( rhs ) ) ;

Gibt die Differenz von lhs und rhs zurück.

Parameter

lhs, rhs - zu subtrahierende Werte

Rückgabewert

std:: forward < T > ( lhs ) - std:: forward < U > ( rhs ) .

Beispiel

#include <complex>
#include <functional>
#include <iostream>
int main()
{
    auto complex_minus = std::minus<void>{}; // "void" kann weggelassen werden
    constexpr std::complex<int> z(4, 2);
    std::cout << complex_minus(z, 1) << '\n';
    std::cout << (z - 1) << '\n';
}

Ausgabe:

(3,2)
(3,2)