|
xentara-utils v2.0.6
The Xentara Utility Library
|
Numeric utilities. More...
Classes | |
| struct | IeeeFloatingPointTraits |
| Information about an IEEE floating point type. More... | |
Functions | |
| template<std::integral Target, std::integral Source> | |
| constexpr auto | clamp (Source source) -> Target |
| Converts an integer to a new type using clamping. | |
| template<tools::Arithmetic Type> | |
| constexpr auto | maxStringSize () -> std::size_t |
| Returns the maximum length needed to hold a number of a certain type. | |
| template<typename Char , typename Number , typename CharTraits = std::char_traits<Char>> | |
| auto | toBasicString (Number number) -> string::BasicStaticString< Char, maxStringSize< Number >(), CharTraits > |
| Converts a number to a string. | |
| template<tools::Arithmetic Number> | |
| auto | toString (Number number) -> string::StaticString< maxStringSize< Number >()> |
| Converts a number to a string of type char | |
| template<tools::Arithmetic Number> | |
| auto | toWString (Number number) -> string::StaticWString< maxStringSize< Number >()> |
| Converts a number to a string of type wchar_t | |
| template<tools::Arithmetic Number> | |
| auto | toU8String (Number number) -> string::StaticU8String< maxStringSize< Number >()> |
| Converts a number to a string of type char8_t | |
| template<tools::Arithmetic Number> | |
| auto | toU16String (Number number) -> string::StaticU16String< maxStringSize< Number >()> |
| Converts a number to a string of type char16_t | |
| template<tools::Arithmetic Number> | |
| auto | toU32String (Number number) -> string::StaticU32String< maxStringSize< Number >()> |
| Converts a number to a string of type char32_t | |
Numeric utilities.
This namespace contains numeric utilities.
|
constexpr |
Converts an integer to a new type using clamping.
Converts an integer to a new type. If the value lies outside the range of the new type, the closest possible value is returned.
#include <xentara/utils/numeric/clamp.hpp> | source | The source integer |
|
constexpr |
Returns the maximum length needed to hold a number of a certain type.
This function can be used to preallocate buffers used to format numeric strings.
#include <xentara/utils/numeric/maxStringSize.hpp> | auto xentara::utils::numeric::toBasicString | ( | Number | number | ) | -> string::BasicStaticString<Char, maxStringSize<Number>(), CharTraits> |
Converts a number to a string.
#include <xentara/utils/numeric/toString.hpp> | number | The number |
| auto xentara::utils::numeric::toString | ( | Number | number | ) | -> string::StaticString<maxStringSize<Number>()> |
Converts a number to a string of type char
#include <xentara/utils/numeric/toString.hpp> | number | The number |
| auto xentara::utils::numeric::toU16String | ( | Number | number | ) | -> string::StaticU16String<maxStringSize<Number>()> |
Converts a number to a string of type char16_t
#include <xentara/utils/numeric/toString.hpp> | number | The number |
| auto xentara::utils::numeric::toU32String | ( | Number | number | ) | -> string::StaticU32String<maxStringSize<Number>()> |
Converts a number to a string of type char32_t
#include <xentara/utils/numeric/toString.hpp> | number | The number |
| auto xentara::utils::numeric::toU8String | ( | Number | number | ) | -> string::StaticU8String<maxStringSize<Number>()> |
Converts a number to a string of type char8_t
#include <xentara/utils/numeric/toString.hpp> | number | The number |
| auto xentara::utils::numeric::toWString | ( | Number | number | ) | -> string::StaticWString<maxStringSize<Number>()> |
Converts a number to a string of type wchar_t
#include <xentara/utils/numeric/toString.hpp> | number | The number |