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

Function object for performing modulus. More...

Public Types

using first_argument_type = T
 Type of the first value to modulus.
 
using result_type = T
 Result type of invoking this object.
 
using second_argument_type = T
 Type of the second value to modulus.
 

Public Member Functions

template<class U = T, arene::base::constraints< std::enable_if_t<!is_integral_v< U > > > = nullptr>
constexpr auto operator() (T const &lhs, T const &rhs) const noexcept(noexcept(std::declval< T & >() % std::declval< T & >())) -> T
 Returns the remainder of the first value divided by second value.
 
template<class U = T, arene::base::constraints< std::enable_if_t< is_integral_v< U > > > = nullptr>
constexpr auto operator() (T const &lhs, T const &rhs) const noexcept(noexcept(std::declval< T & >() % std::declval< T & >())) -> T
 Returns the remainder of the first value divided by second value.
 

Detailed Description

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

Function object for performing modulus.

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

◆ first_argument_type

template<class T = void>
using std::modulus< T >::first_argument_type = T

Type of the first value to modulus.

◆ result_type

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

Result type of invoking this object.

◆ second_argument_type

template<class T = void>
using std::modulus< T >::second_argument_type = T

Type of the second value to modulus.

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::modulus< T >::operator() ( T const & lhs,
T const & rhs ) const -> T
inlineconstexprnoexcept

Returns the remainder of the first value divided by second value.

Template Parameters
UTemplate parameter to enable constraints.
Parameters
lhsThe first value to divide
rhsThe second value to divide
Returns
Returns the result of invoking operator% on lhs and rhs

◆ 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::modulus< T >::operator() ( T const & lhs,
T const & rhs ) const -> T
inlineconstexprnoexcept

Returns the remainder of the first value divided by second value.

Template Parameters
UTemplate parameter to enable constraints.
Parameters
lhsThe first value to divide
rhsThe second value to divide
Returns
Returns the result of invoking operator% on lhs and rhs
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: