libtcspc C++ API
Streaming TCSPC and time tag data processing
Loading...
Searching...
No Matches
tcspc::npint< T > Class Template Reference

Description

template<std::integral T>
class tcspc::npint< T >

Non-promoted integers.

Objects of this type behave similarly to the underlying integer type, except that no integer promotion is applied automatically and no implicit conversion is performed to or from any other type (including bool).

Specializations std::numeric_limits<tcspc::npint<T>> are provided.

Template Parameters
Tunderlying (scalar) integer type

Public Types

using underlying_type = T
 The underlying (scalar) integer type.

Public Member Functions

constexpr npint () noexcept=default
 Construct an uninitialized value.
template<typename U>
constexpr npint (npint< U > const &other)
 Explicitly convert from an npint with a different underlying integer type.
constexpr npint (T value) noexcept
 Construct from a value of the underlying integer type.
constexpr operator T () const noexcept
 Explicitly convert to the underlying integer type.
constexpr auto operator%= (npint rhs) -> npint &
 Remainder assignment operator.
constexpr auto operator&= (npint rhs) noexcept -> npint &
 Bitwise AND assignment operator.
constexpr auto operator*= (npint rhs) -> npint &
 Multiplication assignment operator.
constexpr auto operator+ () const noexcept -> npint
 Unary plus operator.
constexpr auto operator++ () -> npint
 Prefix increment operator.
constexpr auto operator++ (int) -> npint
 Postfix increment operator.
constexpr auto operator+= (npint rhs) -> npint &
 Addition assignment operator.
constexpr auto operator- () const -> npint
 Unary minus operator.
constexpr auto operator-- () -> npint
 Prefix decrement operator.
constexpr auto operator-- (int) -> npint
 Postfix decrement operator.
constexpr auto operator-= (npint rhs) -> npint &
 Subtraction assignment operator.
constexpr auto operator/= (npint rhs) -> npint &
 Division assignment operator.
template<typename U>
constexpr auto operator<<= (npint< U > rhs) -> npint &
 Bitwise left shift assignment operator.
constexpr auto operator<<= (std::integral auto rhs) -> npint &
 Bitwise left shift assignment operator.
template<typename U>
constexpr auto operator>>= (npint< U > rhs) -> npint &
 Bitwise right shift assignment operator.
constexpr auto operator>>= (std::integral auto rhs) -> npint &
 Bitwise right shift assignment operator.
constexpr auto operator^= (npint rhs) noexcept -> npint &
 Bitwise XOR assignment operator.
constexpr auto operator|= (npint rhs) noexcept -> npint &
 Bitwise OR assignment operator.
constexpr auto operator~ () const noexcept -> npint
 Bitwise NOT operator.
constexpr auto value () const noexcept -> T
 Get the value in the underlying integer type.

Friends

constexpr auto operator% (npint lhs, npint rhs) -> npint
 Remainder operator.
constexpr auto operator& (npint lhs, npint rhs) noexcept -> npint
 Bitwise AND operator.
constexpr auto operator* (npint lhs, npint rhs) -> npint
 Multiplication operator.
constexpr auto operator+ (npint lhs, npint rhs) -> npint
 Addition operator.
constexpr auto operator- (npint lhs, npint rhs) -> npint
 Subtraction operator.
constexpr auto operator/ (npint lhs, npint rhs) -> npint
 Division operator.
template<typename U>
constexpr auto operator<< (npint lhs, npint< U > rhs) -> npint
 Bitwise left shift operator.
constexpr auto operator<< (npint lhs, std::integral auto rhs) -> npint
 Bitwise left shift operator.
auto operator<< (std::ostream &strm, npint rhs) -> std::ostream &
 Stream insertion operator.
constexpr auto operator<=> (npint lhs, npint rhs) noexcept -> std::strong_ordering=default
 Three-way comparison operator.
template<typename U>
constexpr auto operator>> (npint lhs, npint< U > rhs) -> npint
 Bitwise right shift operator.
constexpr auto operator>> (npint lhs, std::integral auto rhs) -> npint
 Bitwise right shift operator.
auto operator>> (std::istream &strm, npint &rhs) -> std::istream &
 Stream extraction operator.
constexpr auto operator^ (npint lhs, npint rhs) noexcept -> npint
 Bitwise XOR operator.
constexpr auto operator| (npint lhs, npint rhs) noexcept -> npint
 Bitwise OR operator.

Constructor & Destructor Documentation

◆ npint() [1/3]

template<std::integral T>
tcspc::npint< T >::npint ( )
constexprdefaultnoexcept

Construct an uninitialized value.

Note that the value is not zero-initialized, as with regular integer types (this is necessary for npint to be a trivial type). Brace initialization can be used to zero initialize.

◆ npint() [2/3]

template<std::integral T>
tcspc::npint< T >::npint ( T value)
inlineexplicitconstexprnoexcept

Construct from a value of the underlying integer type.

Parameters
valuethe value

◆ npint() [3/3]

template<std::integral T>
template<typename U>
tcspc::npint< T >::npint ( npint< U > const & other)
inlineexplicitconstexpr

Explicitly convert from an npint with a different underlying integer type.

Conversions that would both widen the integer and change the signedness are prohibited (will not compile), because they would make it ambiguous whether a signed or unsigned extension is desired.

Template Parameters
Uunderlying integer type of source
Parameters
othersource

Member Function Documentation

◆ value()

template<std::integral T>
auto tcspc::npint< T >::value ( ) const -> T
inlinenodiscardconstexprnoexcept

Get the value in the underlying integer type.

Returns
the value

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