xtd 0.2.0
Loading...
Searching...
No Matches
__as_bool.h
Go to the documentation of this file.
1
3#pragma once
4
6#if !defined(__XTD_CORE_INTERNAL__)
7#error "Do not include this file: Internal use only"
8#endif
10
11#define __XTD_STD_INTERNAL__
12#include "__xtd_std_version.h"
13#undef __XTD_STD_INTERNAL__
14
16namespace xtd {
35 template<>
36 inline bool as<bool>(std::any value) {
37 return xtd::convert::to_boolean(value);
38 }
39
57 template<>
58 inline bool as<bool>(bool value) {
59 return xtd::convert::to_boolean(value);
60 }
61
79 template<>
80 inline bool as<bool>(xtd::byte value) {
81 return xtd::convert::to_boolean(value);
82 }
83
102 template<>
103 inline bool as<bool>(char value) {
104 return xtd::convert::to_boolean(value);
105 }
106
107#if defined(__xtd__cpp_lib_char8_t)
126 template<>
127 inline bool as<bool>(char8 value) {
128 return xtd::convert::to_boolean(value);
129 }
130#endif
131
150 template<>
151 inline bool as<bool>(char16 value) {
152 return xtd::convert::to_boolean(value);
153 }
154
173 template<>
174 inline bool as<bool>(char32 value) {
175 return xtd::convert::to_boolean(value);
176 }
177
196 template<>
197 inline bool as<bool>(wchar value) {
198 return xtd::convert::to_boolean(value);
199 }
200
218 template<>
219 inline bool as<bool>(decimal value) {
220 return xtd::convert::to_boolean(value);
221 }
222
240 template<>
241 inline bool as<bool>(double value) {
242 return xtd::convert::to_boolean(value);
243 }
244
262 template<>
263 inline bool as<bool>(float value) {
264 return xtd::convert::to_boolean(value);
265 }
266
284 template<>
285 inline bool as<bool>(int16 value) {
286 return xtd::convert::to_boolean(value);
287 }
288
306 template<>
307 inline bool as<bool>(int32 value) {
308 return xtd::convert::to_boolean(value);
309 }
310
328 template<>
329 inline bool as<bool>(int64 value) {
330 return xtd::convert::to_boolean(value);
331 }
332
350 template<>
351 inline bool as<bool>(slong value) {
352 return xtd::convert::to_boolean(value);
353 }
354
372 template<>
373 inline bool as<bool>(sbyte value) {
374 return xtd::convert::to_boolean(value);
375 }
376
394 template<>
395 inline bool as<bool>(uint16 value) {
396 return xtd::convert::to_boolean(value);
397 }
398
416 template<>
417 inline bool as<bool>(uint32 value) {
418 return xtd::convert::to_boolean(value);
419 }
420
438 template<>
439 inline bool as<bool>(uint64 value) {
440 return xtd::convert::to_boolean(value);
441 }
442
460 template<>
461 inline bool as<bool>(xtd::ulong value) {
462 return xtd::convert::to_boolean(value);
463 }
464
483 template<>
484 inline bool as<bool>(const xtd::string& value) {
485 return xtd::convert::to_boolean(value);
486 }
487
506 template<>
507 inline bool as<bool>(xtd::string& value) {
508 return xtd::convert::to_boolean(value);
509 }
510
529 template<>
530 inline bool as<bool>(const std::string& value) {
531 return xtd::convert::to_boolean(value);
532 }
533
552 template<>
553 inline bool as<bool>(std::string& value) {
554 return xtd::convert::to_boolean(value);
555 }
556
557#if defined(__xtd__cpp_lib_char8_t)
576 template<>
577 inline bool as<bool>(const std::u8string& value) {
578 return xtd::convert::to_boolean(value);
579 }
580
599 template<>
600 inline bool as<bool>(std::u8string& value) {
601 return xtd::convert::to_boolean(value);
602 }
603#endif
604
623 template<>
624 inline bool as<bool>(const std::u16string& value) {
625 return xtd::convert::to_boolean(value);
626 }
627
646 template<>
647 inline bool as<bool>(std::u16string& value) {
648 return xtd::convert::to_boolean(value);
649 }
650
669 template<>
670 inline bool as<bool>(const std::u32string& value) {
671 return xtd::convert::to_boolean(value);
672 }
673
692 template<>
693 inline bool as<bool>(std::u32string& value) {
694 return xtd::convert::to_boolean(value);
695 }
696
715 template<>
716 inline bool as<bool>(const std::wstring& value) {
717 return xtd::convert::to_boolean(value);
718 }
719
738 template<>
739 inline bool as<bool>(std::wstring& value) {
740 return xtd::convert::to_boolean(value);
741 }
742
761 template<>
762 inline bool as<bool>(const char* value) {
763 return xtd::convert::to_boolean(value);
764 }
765
784 template<>
785 inline bool as<bool>(char* value) {
786 return xtd::convert::to_boolean(value);
787 }
788
789#if defined(__xtd__cpp_lib_char8_t)
808 template<>
809 inline bool as<bool>(const char8* value) {
810 return xtd::convert::to_boolean(value);
811 }
812
831 template<>
832 inline bool as<bool>(char8* value) {
833 return xtd::convert::to_boolean(value);
834 }
835#endif
836
855 template<>
856 inline bool as<bool>(const char16* value) {
857 return xtd::convert::to_boolean(value);
858 }
859
878 template<>
879 inline bool as<bool>(char16* value) {
880 return xtd::convert::to_boolean(value);
881 }
882
901 template<>
902 inline bool as<bool>(const char32* value) {
903 return xtd::convert::to_boolean(value);
904 }
905
924 template<>
925 inline bool as<bool>(char32* value) {
926 return xtd::convert::to_boolean(value);
927 }
928
947 template<>
948 inline bool as<bool>(const wchar* value) {
949 return xtd::convert::to_boolean(value);
950 }
951
970 template<>
971 inline bool as<bool>(wchar* value) {
972 return xtd::convert::to_boolean(value);
973 }
974}
Contains __xtd_std_version definitions.
Represents text as a sequence of character units.
Definition basic_string.h:79
static bool to_boolean(std::any value)
Convert std::any to bool.
int16_t int16
Represents a 16-bit signed integer.
Definition int16.h:23
char8_t char8
Represents a 8-bit unicode character.
Definition char8.h:27
wchar_t wchar
Represents a wide character.
Definition wchar.h:24
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.h:23
int64_t int64
Represents a 64-bit signed integer.
Definition int64.h:23
__ulong__ ulong
Represents a 32-bit or 64-bit unsigned integer.
Definition ulong.h:27
int8_t sbyte
Represents a 8-bit signed integer.
Definition sbyte.h:23
char16_t char16
Represents a 16-bit unicode character.
Definition char16.h:26
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
char32_t char32
Represents a 32-bit unicode character.
Definition char32.h:26
uint64_t uint64
Represents a 64-bit unsigned integer.
Definition uint64.h:23
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.h:23
uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.h:23
__slong__ slong
Represents a 32-bit or 64-bit signed integer.
Definition slong.h:27
bool as< bool >(std::any value)
Casts a type into another type.
Definition __as_bool.h:36
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10