Namespaces
Variants

std:: plus<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* )
Definido en el encabezado <functional>
template <>
class plus < void > ;
(desde C++14)

std:: plus < void > es una especialización de std::plus con tipo de parámetro y retorno deducidos.

Contenidos

Tipos de miembros

Tipo Definición
is_transparent unspecified

Funciones miembro

operator()
devuelve la suma de dos argumentos
(función miembro pública)

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

template < class T, class U >

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

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

Devuelve la suma de lhs y rhs .

Parámetros

lhs, rhs - valores a sumar

Valor de retorno

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

Ejemplo

#include <functional>
#include <iostream>
int main()
{
    auto string_plus = std::plus<void>{}; // “void” se puede omitir
    std::string a = "Hello ";
    const char* b = "world";
    std::cout << string_plus(a, b) << '\n';
}

Salida:

Hello world