xtd 0.2.0
Loading...
Searching...
No Matches
xtd::integer< type_t > Struct Template Reference

Definition

template<typename type_t>
struct xtd::integer< type_t >

Represents the integer concept.

Definition
template<typename type_t>
Definition integer.hpp:12
Definition signed_integer.hpp:14
Definition unsigned_integer.hpp:14
Header
#include <xtd/integer>
Namespace
xtd
Library
xtd.core
Examples
The following code shows how to use xtd::integer concept
#include <xtd/xtd>
auto print_is_integer(auto value) noexcept {
println("{} ({}) {} integer", value, type_of(value), integer<decltype(value)> ? "is" : "is not");
}
auto main() -> int {
print_is_integer(42_s8);
print_is_integer(42_s16);
print_is_integer(42_s32);
print_is_integer(42_s64);
print_is_integer(42_u8);
print_is_integer(42_u16);
print_is_integer(42_u32);
print_is_integer(42_u64);
print_is_integer(42_z);
print_is_integer(42.84f);
print_is_integer(42.84);
print_is_integer(42.84l);
print_is_integer('a');
print_is_integer(true);
print_is_integer("string"_s);
print_is_integer("string");
print_is_integer(1_h + 12_min + 24_s + 48_ms);
print_is_integer(day_of_week::wednesday);
}
// This code produces the following output :
//
// 42 (signed char) is integer
// 42 (short) is integer
// 42 (int) is integer
// 42 (long long) is integer
// 42 (unsigned char) is integer
// 42 (unsigned short) is integer
// 42 (unsigned int) is integer
// 42 (unsigned long long) is integer
// 42 (unsigned long) is integer
// 42.84 (float) is not integer
// 42.84 (double) is not integer
// 42.84 (long double) is not integer
// true (bool) is not integer
// string (xtd::basic_string<char, std::char_traits<char>, std::allocator<char>>) is not integer
// string (char const*) is not integer
// 01:12:24.0480000 (xtd::time_span) is not integer
// wednesday (xtd::day_of_week) is not integer
@ wednesday
Indicates wednesday.
Definition day_of_week.hpp:33
void println()
Writes the current line terminator to the standard output stream using the specified format informati...
Definition println.hpp:167

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