Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/functional/negate"

From cppreference.com
< cpp‎ | utility‎ | functional
m (Text replace - "{{eq fun cpp" to "{{eq fun")
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, ru, zh)
Line 49: Line 49:
 
}}
 
}}
 
}}
 
}}
 +
 +
[[de:cpp/utility/functional/negate]]
 +
[[es:cpp/utility/functional/negate]]
 +
[[fr:cpp/utility/functional/negate]]
 +
[[it:cpp/utility/functional/negate]]
 +
[[ja:cpp/utility/functional/negate]]
 +
[[pt:cpp/utility/functional/negate]]
 +
[[ru:cpp/utility/functional/negate]]
 +
[[zh:cpp/utility/functional/negate]]

Revision as of 12:59, 2 November 2012

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
Function objects
Function invocation
(C++17)(C++23)
Identity function object
(C++20)
Transparent operator wrappers
(C++14)
(C++14)
(C++14)
(C++14)  
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)

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++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*)
 

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <functional>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class T >
struct negate;
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

Function object for performing negation. Effectively calls operator- on an instance of type T.

Contents

Member types

Type Definition
result_type T
argument_type T

Member functions

operator()
returns the negation of the argument
(public member function)

std::negate::operator()

T operator()( const T& arg ) const;

Returns the negation of arg.

Parameters

arg - value to compute negation of

Return value

The result of -arg.

Exceptions

(none)

Possible implementation

T operator()(const T &arg) const 
{
    return -arg;
}