Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::negate< T > Class Template Reference

Function object for performing negation. More...

Public Types

using argument_type = T
 Type of the value to negate.
 
using result_type = T
 Result type of invoking this object.
 

Public Member Functions

template<class U = T, arene::base::constraints< std::enable_if_t<!is_integral_v< U > > > = nullptr>
constexpr auto operator() (T const &value) const noexcept(noexcept(-std::declval< T >())) -> T
 Returns the negation of the value.
 
template<class U = T, arene::base::constraints< std::enable_if_t< is_integral_v< U > > > = nullptr>
constexpr auto operator() (T const &value) const noexcept(noexcept(-std::declval< T >())) -> T
 Returns the negation of the value.
 

Detailed Description

template<class T = void>
class std::negate< T >

Function object for performing negation.

Template Parameters
TThe type of the values
Note
This class contains the member types result_type, first_argument type, and second_argument type. These aliases have been deprecated in C++17 and removed in C++20.

Member Typedef Documentation

◆ argument_type

template<class T = void>
using std::negate< T >::argument_type = T

Type of the value to negate.

◆ result_type

template<class T = void>
using std::negate< T >::result_type = T

Result type of invoking this object.

Member Function Documentation

◆ operator()() [1/2]

template<class T = void>
template<class U = T, arene::base::constraints< std::enable_if_t<!is_integral_v< U > > > = nullptr>
auto std::negate< T >::operator() ( T const & value) const -> T
inlineconstexprnoexcept

Returns the negation of the value.

Template Parameters
UTemplate parameter to enable constraints.
Parameters
valueThe value to negate
Returns
Returns the result of invoking operator- on value

◆ operator()() [2/2]

template<class T = void>
template<class U = T, arene::base::constraints< std::enable_if_t< is_integral_v< U > > > = nullptr>
auto std::negate< T >::operator() ( T const & value) const -> T
inlineconstexprnoexcept

Returns the negation of the value.

Template Parameters
UTemplate parameter to enable constraints.
Parameters
valueThe value to negate
Returns
Returns the result of invoking operator- on value
Note
This overload explicitly casts the result of the computation to the type T. This avoids any warning for implicit conversion (present on gcc8).

The documentation for this class was generated from the following file: