# std::plus<void>

> C++ Atlas: `cppatlas.com/w/cpp/utility/functional/plus_void` | Source: https://en.cppreference.com/w/cpp/utility/functional/plus_void | Domain: Utility | Standards: C++14

std::plus<void> is a specialization of std::plus with parameter and return type deduced.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <functional>

template<>
class plus<void>; // (since C++14)
```

`std::plus<void>` is a specialization of `std::plus` with parameter and return type deduced.

#### Member types

**Type — Definition**

- `is_transparent`: unspecified

#### Member functions

- `operator()`: returns the sum of two arguments (public member function)

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

```cpp
template< class T, class U >
constexpr auto operator()( T&& lhs, U&& rhs ) const
    -> decltype(std::forward<T>(lhs) + std::forward<U>(rhs));
```

Returns the sum of `lhs` and `rhs`.

#### Parameters

- `lhs, rhs` - values to sum

#### Return value

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

#### Example

```cpp
#include <functional>
#include <iostream>

int main()
{
    auto string_plus = std::plus<void>{}; // “void” can be omitted
    std::string a = "Hello ";
    const char* b = "world";
    std::cout << string_plus(a, b) << '\n';
}
```

Output:

```text
Hello world
```

---
Attribution: content from https://en.cppreference.com/w/cpp/utility/functional/plus_void (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.