1#ifndef NEFORCE_CORE_INTERFACE_INUMERIC_HPP__
2#define NEFORCE_CORE_INTERFACE_INUMERIC_HPP__
13NEFORCE_BEGIN_NAMESPACE__
36 constexpr const T& derived()
const noexcept {
return static_cast<const T&
>(*this); }
42 constexpr T& derived()
noexcept {
return static_cast<T&
>(*this); }
50 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator+(
const T& other)
const
51 noexcept(
noexcept(
const_cast<T&
>(derived()).operator+=(other))) {
62 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator-(
const T& other)
const
63 noexcept(
noexcept(
const_cast<T&
>(derived()).operator-=(other))) {
74 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator*(
const T& other)
const
75 noexcept(
noexcept(
const_cast<T&
>(derived()).operator*=(other))) {
86 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator/(
const T& other)
const
87 noexcept(
noexcept(
const_cast<T&
>(derived()).operator/=(other))) {
98 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator%(
const T& other)
const
99 noexcept(
noexcept(
const_cast<T&
>(derived()).operator%=(other))) {
110 NEFORCE_CONSTEXPR14 T&
operator+=(
const T& other)
noexcept(
noexcept(derived().operator+=(other))) {
111 return derived().operator+=(other);
119 NEFORCE_CONSTEXPR14 T&
operator-=(
const T& other)
noexcept(
noexcept(derived().operator-=(other))) {
120 return derived().operator-=(other);
128 NEFORCE_CONSTEXPR14 T&
operator*=(
const T& other)
noexcept(
noexcept(derived().operator*=(other))) {
129 return derived().operator*=(other);
137 NEFORCE_CONSTEXPR14 T&
operator/=(
const T& other) {
return derived().operator/=(other); }
144 NEFORCE_CONSTEXPR14 T&
operator%=(
const T& other) {
return derived().operator%=(other); }
150 NEFORCE_CONSTEXPR14 T&
operator++() noexcept(noexcept(derived().operator++())) {
return derived().operator++(); }
156 NEFORCE_CONSTEXPR14 T
operator++(
int)
noexcept(
noexcept(derived().operator++())) {
166 NEFORCE_CONSTEXPR14 T&
operator--() noexcept(noexcept(derived().operator--())) {
return derived().operator--(); }
172 NEFORCE_CONSTEXPR14 T
operator--(
int)
noexcept(
noexcept(derived().operator--())) {
195 constexpr const T& derived()
const noexcept {
return static_cast<const T&
>(*this); }
201 constexpr T& derived()
noexcept {
return static_cast<T&
>(*this); }
209 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator&(
const T& other)
const
210 noexcept(
noexcept(
const_cast<T&
>(derived()).operator&=(other))) {
221 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator|(
const T& other)
const
222 noexcept(
noexcept(
const_cast<T&
>(derived()).operator|=(other))) {
233 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator^(
const T& other)
const
234 noexcept(
noexcept(
const_cast<T&
>(derived()).operator^=(other))) {
244 NEFORCE_NODISCARD NEFORCE_CONSTEXPR14 T
operator~() const noexcept(noexcept(derived().operator~())) {
245 return derived().operator~();
274 NEFORCE_CONSTEXPR14 T&
operator&=(
const T& other)
noexcept(
noexcept(derived().operator&=(other))) {
275 return derived().operator&=(other);
283 NEFORCE_CONSTEXPR14 T&
operator|=(
const T& other)
noexcept(
noexcept(derived().operator|=(other))) {
284 return derived().operator|=(other);
292 NEFORCE_CONSTEXPR14 T&
operator^=(
const T& other)
noexcept(
noexcept(derived().operator^=(other))) {
293 return derived().operator^=(other);
313NEFORCE_END_NAMESPACE__
unsigned int uint32_t
32位无符号整数类型
constexpr T & operator/=(const T &other)
除法赋值运算符
constexpr T operator--(int) noexcept(noexcept(derived().operator--()))
后置自减运算符
constexpr T & operator-=(const T &other) noexcept(noexcept(derived().operator-=(other)))
减法赋值运算符
constexpr T operator/(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator/=(other)))
除法运算符
constexpr T & operator++() noexcept(noexcept(derived().operator++()))
前置自增运算符
constexpr T operator+(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator+=(other)))
加法运算符
constexpr T & operator+=(const T &other) noexcept(noexcept(derived().operator+=(other)))
加法赋值运算符
constexpr T operator%(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator%=(other)))
取模运算符
constexpr T operator++(int) noexcept(noexcept(derived().operator++()))
后置自增运算符
constexpr T & operator--() noexcept(noexcept(derived().operator--()))
前置自减运算符
constexpr T operator-(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator-=(other)))
减法运算符
constexpr T & operator*=(const T &other) noexcept(noexcept(derived().operator*=(other)))
乘法赋值运算符
constexpr T operator*(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator*=(other)))
乘法运算符
constexpr T & operator%=(const T &other)
取模赋值运算符
constexpr T operator|(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator|=(other)))
按位或运算符
constexpr T operator~() const noexcept(noexcept(derived().operator~()))
按位取反运算符
constexpr T & operator&=(const T &other) noexcept(noexcept(derived().operator&=(other)))
按位与赋值运算符
constexpr T & operator|=(const T &other) noexcept(noexcept(derived().operator|=(other)))
按位或赋值运算符
constexpr T & operator>>=(const uint32_t shift)
右移赋值运算符
constexpr T operator<<(const uint32_t shift) const
左移运算符
constexpr T & operator<<=(const uint32_t shift)
左移赋值运算符
constexpr T operator>>(const uint32_t shift) const
右移运算符
constexpr T operator&(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator&=(other)))
按位与运算符
constexpr T & operator^=(const T &other) noexcept(noexcept(derived().operator^=(other)))
按位异或赋值运算符
constexpr T operator^(const T &other) const noexcept(noexcept(const_cast< T & >(derived()).operator^=(other)))
按位异或运算符