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

Definition

template<class type_t>
struct xtd::character< type_t >

Represents the character concept.

Definition
template<class type_t>
concept xtd::character = std::same_as<xtd::raw_type<type_t>, xtd::char_> || std::same_as<xtd::raw_type<type_t>, xtd::char8> || std::same_as<xtd::raw_type<type_t>, xtd::char16> || std::same_as<xtd::raw_type<type_t>, xtd::char32> || std::same_as<xtd::raw_type<type_t>, xtd::wchar>;
Definition character.hpp:17
char8_t char8
Represents a 8-bit unicode character.
Definition char8.hpp:26
wchar_t wchar
Represents a wide character.
Definition wchar.hpp:24
char char_
Represents a character.
Definition char.hpp:24
char16_t char16
Represents a 16-bit unicode character.
Definition char16.hpp:26
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:23
Header
#include <xtd/character>
Namespace
xtd
Library
xtd.core
Examples
The following code shows how to use xtd::character concept
#include <xtd/xtd>
auto print_is_character(auto value) noexcept {
println("{} ({}) {} character", value, type_of(value), character<decltype(value)> ? "is" : "is not");
}
auto main() -> int {
print_is_character(42_s8);
print_is_character(42_s16);
print_is_character(42_s32);
print_is_character(42_s64);
print_is_character(42_u8);
print_is_character(42_u16);
print_is_character(42_u32);
print_is_character(42_u64);
print_is_character(42_z);
print_is_character(42.84f);
print_is_character(42.84);
print_is_character(42.84l);
print_is_character('a');
print_is_character(u'a');
print_is_character(U'a');
print_is_character(u8'a');
print_is_character(L'a');
print_is_character(true);
print_is_character("string"_s);
print_is_character("string");
print_is_character(1_h + 12_min + 24_s + 48_ms);
print_is_character(day_of_week::wednesday);
}
// This code produces the following output :
//
// 42 (signed char) is not character
// 42 (short) is not character
// 42 (int) is not character
// 42 (long long) is not character
// 42 (unsigned char) is not character
// 42 (unsigned short) is not character
// 42 (unsigned int) is not character
// 42 (unsigned long long) is not character
// 42 (unsigned long) is not character
// 42.84 (float) is not character
// 42.84 (double) is not character
// 42.84 (long double) is not character
// a (char) is character
// a (char16_t) is character
// a (char32_t) is character
// a (char8_t) is character
// a (wchar_t) is character
// true (bool) is not character
// string (xtd::basic_string<char, std::char_traits<char>, std::allocator<char>>) is not character
// string (char const*) is not character
// 01:12:24.0480000 (xtd::time_span) is not character
// wednesday (xtd::day_of_week) is not character
@ u
The U key.
Definition console_key.hpp:128
@ 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
Examples
format_class_with_specified_formating.cpp, format_class_with_specified_formating_with_to_string.cpp, format_exception.cpp, sprintf_class_with_specified_formating.cpp, and sprintf_class_with_specified_formating_with_to_string.cpp.

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