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

Definition

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

Represents the textual literal concept.

Definition
template<class type_t>
concept xtd::textual_literal = std::same_as<type_t, const xtd::char_*> || std::same_as<type_t, const xtd::wchar*> || std::same_as<type_t, const xtd::char8*> || std::same_as<type_t, const xtd::char16*> || std::same_as<type_t, const xtd::char32*>;
Definition textual_literal.hpp:17
Header
#include <xtd/textual_literal>
Namespace
xtd
Library
xtd.core
Examples
The following code shows how to use xtd::textual_literal concept
#include <xtd/xtd>
auto print_is_textual_literal(auto value) noexcept {
println("{} ({}) {} textual_literal", value, type_of(value), textual_literal<decltype(value)> ? "is" : "is not");
}
auto main() -> int {
print_is_textual_literal(42_s8);
print_is_textual_literal(42_s16);
print_is_textual_literal(42_s32);
print_is_textual_literal(42_s64);
print_is_textual_literal(42_u8);
print_is_textual_literal(42_u16);
print_is_textual_literal(42_u32);
print_is_textual_literal(42_u64);
print_is_textual_literal(42_z);
print_is_textual_literal(42.84f);
print_is_textual_literal(42.84);
print_is_textual_literal(42.84l);
print_is_textual_literal('a');
print_is_textual_literal(true);
print_is_textual_literal("string"_s);
print_is_textual_literal("string");
print_is_textual_literal(1_h + 12_min + 24_s + 48_ms);
print_is_textual_literal(day_of_week::wednesday);
}
// This code produces the following output :
//
// 42 (signed char) is not textual_literal
// 42 (short) is not textual_literal
// 42 (int) is not textual_literal
// 42 (long long) is not textual_literal
// 42 (unsigned char) is not textual_literal
// 42 (unsigned short) is not textual_literal
// 42 (unsigned int) is not textual_literal
// 42 (unsigned long long) is not textual_literal
// 42 (unsigned long) is not textual_literal
// 42.84 (float) is not textual_literal
// 42.84 (double) is not textual_literal
// 42.84 (long double) is not textual_literal
// true (bool) is not textual_literal
// string (xtd::basic_string<char, std::char_traits<char>, std::allocator<char>>) is not textual_literal
// string (char const*) is textual_literal
// 01:12:24.0480000 (xtd::time_span) is not textual_literal
// wednesday (xtd::day_of_week) is not textual_literal
@ 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: