einsums::print::ordinal#

Note

Generated from the C++ headers by apiary --emit-cpp-docs-json.

Defined in header Einsums/Print.hpp.

template<std::integral IntType>
class ordinal#

Wraps an integer that prints with its ordinal suffix (1st, 2nd, …), negatives included:

fmt::format("Error with the {} argument", print::ordinal{arg_num});

It supports in-place arithmetic like the integer it wraps, and has a _th literal suffix:

fmt::format("Error with the {} argument", 3_th);

Added in version 1.0.0.

Changed in version 2.0.0: Added the literal suffix operator.

Template Parameters:

IntType – The integer type the ordinal will wrap.

constexpr ordinal() = default#
constexpr ordinal(const ordinal<IntType> &other) = default#

Copy constructor.

Added in version 1.0.0.

Parameters:

other – The ordinal to copy.

constexpr ordinal(ordinal<IntType> &&other) noexcept#

Move constructor.

Added in version 1.0.0.

Parameters:

other – The ordinal to move. On exit, this may be invalidated.

constexpr ordinal(const IntType &value)#

Cast constructor.

Added in version 1.0.0.

Parameters:

value – The integer to wrap.

constexpr ~ordinal() = default#

Destructor.

Added in version 1.0.0.

constexpr ordinal<IntType> &operator=(const ordinal<IntType> &other) = default#

Copy assignment.

Added in version 1.0.0.

Parameters:

other – The ordinal to copy.

constexpr ordinal<IntType> &operator=(ordinal<IntType> &&other) noexcept#

Move assignment.

Added in version 1.0.0.

Parameters:

other – The ordinal to move. On exit, this may be invalidated.

constexpr operator IntType() const#

Cast to underlying integer type.

constexpr operator IntType&()#

Cast to reference of the underlying integer type.

Added in version 1.0.0.

Returns:

A reference to the storage member.

template<typename T>
constexpr operator T() const#

Cast to arbitrary type.

Added in version 1.0.0.

template<std::integral OtherType>
constexpr ordinal<IntType> &operator+=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator+=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator-=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator-=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator*=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator*=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator/=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator/=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator%=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator%=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator<<=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator<<=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator>>=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator>>=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator^=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator^=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator&=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator&=(const OtherType &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator|=(const ordinal<OtherType> &other)#
template<std::integral OtherType>
constexpr ordinal<IntType> &operator|=(const OtherType &other)#
template<std::integral OtherType>
constexpr bool operator==(const ordinal<OtherType> &other) const#
template<std::integral OtherType>
constexpr bool operator==(const OtherType &other) const#