OGLplus  (0.59.0) a C++ wrapper for rendering APIs

Class representing a positive or negative numeric sign. More...

#include <eagine/math/sign.hpp>

Public Types

using type = sign
 Alias for sign class.
 
using value_type = T
 Alias for the value type T.
 

Public Member Functions

constexpr sign () noexcept=default
 Default constructor (constructs a positive sign).
 
constexpr sign (bool pos) noexcept
 Construction with explicit specitication of the sign.
 
template<typename X , typename = std::enable_if_t<!std::is_same_v<X, sign<T>>>>
constexpr sign (const X &value) noexcept
 Construction taking the sign from the specified numeric value.
 
template<typename X , typename = std::enable_if_t<!std::is_same_v<X, sign<T>>>>
auto operator= (const X &value) noexcept -> auto &
 Assignment taking the sign from the specified numeric value.
 
 operator T () const noexcept
 Returns either 1 if this sign is positive or -1 if negative.
 
auto flip () noexcept -> auto &
 Flip this sign from positive to negative or vice-versa. More...
 
auto flipped () const noexcept -> sign
 Returns a new sign opposite to this sign. More...
 
auto operator- () const noexcept -> sign
 Returns a new sign opposite to this sign. More...
 
auto operator! () const noexcept -> sign
 Returns a new sign opposite to this sign. More...
 

Static Public Member Functions

static constexpr auto plus () noexcept -> sign
 Constructs a positive sign (plus). More...
 
static constexpr auto minus () noexcept -> sign
 Constructs a negative sign (minus). More...
 

Detailed Description

template<typename T>
class eagine::math::sign< T >

Class representing a positive or negative numeric sign.

Instances of this class can be multiplied to values of type T.

Member Function Documentation

◆ flip()

template<typename T >
auto eagine::math::sign< T >::flip ( ) -> auto&
inlinenoexcept

Flip this sign from positive to negative or vice-versa.

See also
flipped

◆ flipped()

template<typename T >
auto eagine::math::sign< T >::flipped ( ) const -> sign
inlinenoexcept

Returns a new sign opposite to this sign.

See also
flip

Referenced by eagine::math::sign< float >::operator!(), and eagine::math::sign< float >::operator-().

◆ minus()

template<typename T >
static constexpr auto eagine::math::sign< T >::minus ( ) -> sign
inlinestaticconstexprnoexcept

Constructs a negative sign (minus).

See also
plus

◆ operator!()

template<typename T >
auto eagine::math::sign< T >::operator! ( ) const -> sign
inlinenoexcept

Returns a new sign opposite to this sign.

See also
flipped
flip

◆ operator-()

template<typename T >
auto eagine::math::sign< T >::operator- ( ) const -> sign
inlinenoexcept

Returns a new sign opposite to this sign.

See also
flipped
flip

◆ plus()

template<typename T >
static constexpr auto eagine::math::sign< T >::plus ( ) -> sign
inlinestaticconstexprnoexcept

Constructs a positive sign (plus).

See also
minus

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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).