piranha  0.10
Public Member Functions | List of all members
piranha::math::negate_impl< T, typename > Struct Template Reference

Default functor for the implementation of piranha::math::negate(). More...

#include <piranha/math.hpp>

Public Member Functions

template<typename U , generic_enabler< U > = 0>
void operator() (U &x) const
 Generic call operator. More...
 
template<typename U , integral_enabler< U > = 0>
void operator() (U &x) const
 Call operator specialised for integral types. More...
 

Detailed Description

template<typename T, typename = void>
struct piranha::math::negate_impl< T, typename >

Default functor for the implementation of piranha::math::negate().

This functor should be specialised via the std::enable_if mechanism. Default implementation will assign to the input value its negation.

Definition at line 253 of file math.hpp.

Member Function Documentation

◆ operator()() [1/2]

template<typename T , typename = void>
template<typename U , generic_enabler< U > = 0>
void piranha::math::negate_impl< T, typename >::operator() ( U &  x) const
inline

Generic call operator.

Note
This operator is enabled only if the expression x = -x is well-formed and U is not a C++ integral type.

The body of the operator is equivalent to:

x = -x;

The other overload of this operator is specialised for C++ integral types, and it behaves identically.

Parameters
xvalue to be negated.
Exceptions
unspecifiedany exception resulting from the in-place negation or assignment of x.

Definition at line 282 of file math.hpp.

◆ operator()() [2/2]

template<typename T , typename = void>
template<typename U , integral_enabler< U > = 0>
void piranha::math::negate_impl< T, typename >::operator() ( U &  x) const
inline

Call operator specialised for integral types.

Parameters
xthe integral value that will be negated.

Definition at line 291 of file math.hpp.


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