24#define ALIB_VERSION 2412
25#define ALIB_REVISION 0
36#if !defined( ALIB_ALOX ) \
37 && !defined( ALIB_BITBUFFER ) \
38 && !defined( ALIB_BOXING ) \
39 && !defined( ALIB_CHARACTERS ) \
40 && !defined( ALIB_CLI ) \
41 && !defined( ALIB_CONFIGURATION) \
42 && !defined( ALIB_CONTAINERS ) \
43 && !defined( ALIB_ENUMS ) \
44 && !defined( ALIB_EXPRESSIONS ) \
45 && !defined( ALIB_FILES ) \
46 && !defined( ALIB_MONOMEM ) \
47 && !defined( ALIB_SINGLETONS ) \
48 && !defined( ALIB_STRINGS ) \
49 && !defined( ALIB_CAMP ) \
50 && !defined( ALIB_TIME ) \
51 && !defined( ALIB_THREADMODEL ) \
52 && !defined( ALIB_THREADS )
54# define ALIB_EXPRESSIONS 1
57# define ALIB_THREADMODEL 1
58# define ALIB_BITBUFFER 1
61#if !defined(ALIB_ALOX )
64#if !defined(ALIB_BITBUFFER )
65# define ALIB_BITBUFFER 0
67#if !defined(ALIB_BOXING )
70#if !defined(ALIB_TIME )
73#if !defined(ALIB_CLI )
76#if !defined(ALIB_CHARACTERS )
77# define ALIB_CHARACTERS 0
79#if !defined(ALIB_CONTAINERS)
80# define ALIB_CONTAINERS 0
82#if !defined(ALIB_CONFIGURATION)
83# define ALIB_CONFIGURATION 0
85#if !defined(ALIB_ENUMS )
88#if !defined(ALIB_EXPRESSIONS )
89# define ALIB_EXPRESSIONS 0
91#if !defined(ALIB_FILES )
94#if !defined(ALIB_MONOMEM )
95# define ALIB_MONOMEM 0
97#if !defined(ALIB_SINGLETONS )
98# define ALIB_SINGLETONS 0
100#if !defined(ALIB_STRINGS )
101# define ALIB_STRINGS 0
103#if !defined(ALIB_CAMP )
106#if !defined( ALIB_THREADMODEL )
107# define ALIB_THREADMODEL 0
109#if !defined( ALIB_THREADS )
110# define ALIB_THREADS 0
118# undef ALIB_CONFIGURATION
119# define ALIB_CONFIGURATION 1
125#if ALIB_CONFIGURATION
139# define ALIB_STRINGS 1
141# define ALIB_BOXING 1
142# undef ALIB_CONTAINERS
143# define ALIB_CONTAINERS 1
149# define ALIB_MONOMEM 1
153# define ALIB_MONOMEM 1
154# undef ALIB_CONTAINERS
155# define ALIB_CONTAINERS 1
161# define ALIB_BOXING 1
162# undef ALIB_CONTAINERS
163# define ALIB_CONTAINERS 1
167# define ALIB_MONOMEM 1
169# define ALIB_THREADS 1
173# define ALIB_STRINGS 1
174# undef ALIB_SINGLETONS
175# define ALIB_SINGLETONS 1
179# define ALIB_STRINGS 1
184# undef ALIB_CHARACTERS
185# define ALIB_CHARACTERS 1
188# undef ALIB_SINGLETONS
189# define ALIB_SINGLETONS 1
190# undef ALIB_CHARACTERS
191# define ALIB_CHARACTERS 1
199#define ALIB_BITBUFFER 1
202#define ALIB_CHARACTERS 1
204#define ALIB_CONFIGURATION 1
205#define ALIB_CONTAINERS 1
207#define ALIB_EXPRESSIONS 1
209#define ALIB_MONOMEM 1
210#define ALIB_SINGLETONS 1
211#define ALIB_STRINGS 1
212#define ALIB_THREADMODEL 1
213#define ALIB_THREADS 1
221#define ALIB_DOCUMENTATION_URL "https://alib.dev/"
223#define ALIB_ASSERT_MODULE(modulename) \
224static_assert( ALIB_ ## modulename, \
225 "This module is not included in the ALib distribution/built. " \
226 "See " ALIB_DOCUMENTATION_URL "alib_manual.html for more information" ); \
232# define IF_ALIB_ALOX(...) __VA_ARGS__
233# define IFNOT_ALIB_ALOX(...)
235# define IF_ALIB_ALOX(...)
236# define IFNOT_ALIB_ALOX(...) __VA_ARGS__
240# define IF_ALIB_BITBUFFER(...) __VA_ARGS__
241# define IFNOT_ALIB_BITBUFFER(...)
243# define IF_ALIB_BITBUFFER(...)
244# define IFNOT_ALIB_BITBUFFER(...) __VA_ARGS__
248# define IF_ALIB_BOXING(...) __VA_ARGS__
249# define IFNOT_ALIB_BOXING(...)
251# define IF_ALIB_BOXING(...)
252# define IFNOT_ALIB_BOXING(...) __VA_ARGS__
256# define IF_ALIB_CHARACTERS(...) __VA_ARGS__
257# define IFNOT_ALIB_CHARACTERS(...)
259# define IF_ALIB_CHARACTERS(...)
260# define IFNOT_ALIB_CHARACTERS(...) __VA_ARGS__
264# define IF_ALIB_CLI(...) __VA_ARGS__
265# define IFNOT_ALIB_CLI(...)
267# define IF_ALIB_CLI(...)
268# define IFNOT_ALIB_CLI(...) __VA_ARGS__
271#if ALIB_CONFIGURATION
272# define IF_ALIB_CONFIGURATION(...) __VA_ARGS__
273# define IFNOT_ALIB_CONFIGURATION(...)
275# define IF_ALIB_CONFIGURATION(...)
276# define IFNOT_ALIB_CONFIGURATION(...) __VA_ARGS__
280# define IF_ALIB_CONTAINERS(...) __VA_ARGS__
281# define IFNOT_ALIB_CONTAINERS(...)
283# define IF_ALIB_CONTAINERS(...)
284# define IFNOT_ALIB_CONTAINERS(...) __VA_ARGS__
288# define IF_ALIB_ENUMS(...) __VA_ARGS__
289# define IFNOT_ALIB_ENUMS(...)
291# define IF_ALIB_ENUMS(...)
292# define IFNOT_ALIB_ENUMS(...) __VA_ARGS__
296# define IF_ALIB_EXPRESSIONS(...) __VA_ARGS__
297# define IFNOT_ALIB_EXPRESSIONS(...)
299# define IF_ALIB_EXPRESSIONS(...)
300# define IFNOT_ALIB_EXPRESSIONS(...) __VA_ARGS__
304# define IF_ALIB_FILES(...) __VA_ARGS__
305# define IFNOT_ALIB_FILES(...)
307# define IF_ALIB_FILES(...)
308# define IFNOT_ALIB_FILES(...) __VA_ARGS__
312# define IF_ALIB_MONOMEM(...) __VA_ARGS__
313# define IFNOT_ALIB_MONOMEM(...)
315# define IF_ALIB_MONOMEM(...)
316# define IFNOT_ALIB_MONOMEM(...) __VA_ARGS__
320# define IF_ALIB_SINGLETONS(...) __VA_ARGS__
321# define IFNOT_ALIB_SINGLETONS(...)
323# define IF_ALIB_SINGLETONS(...)
324# define IFNOT_ALIB_SINGLETONS(...) __VA_ARGS__
328# define IF_ALIB_STRINGS(...) __VA_ARGS__
329# define IFNOT_ALIB_STRINGS(...)
331# define IF_ALIB_STRINGS(...)
332# define IFNOT_ALIB_STRINGS(...) __VA_ARGS__
336# define IF_ALIB_CAMP(...) __VA_ARGS__
337# define IFNOT_ALIB_CAMP(...)
339# define IF_ALIB_CAMP(...)
340# define IFNOT_ALIB_CAMP(...) __VA_ARGS__
344# define IF_ALIB_THREADMODEL(...) __VA_ARGS__
345# define IFNOT_ALIB_THREADMODEL(...)
347# define IF_ALIB_THREADMODEL(...)
348# define IFNOT_ALIB_THREADMODEL(...) __VA_ARGS__
352# define IF_ALIB_THREADS(...) __VA_ARGS__
353# define IFNOT_ALIB_THREADS(...)
355# define IF_ALIB_THREADS(...)
356# define IFNOT_ALIB_THREADS(...) __VA_ARGS__
360# define IF_ALIB_TIME(...) __VA_ARGS__
361# define IFNOT_ALIB_TIME(...)
363# define IF_ALIB_TIME(...)
364# define IFNOT_ALIB_TIME(...) __VA_ARGS__
370#if !defined(ALIB_EXT_LIB_THREADS_AVAILABLE)
371# define ALIB_EXT_LIB_THREADS_AVAILABLE 1
374#if !defined(ALIB_FEAT_BOOST_REGEX)
375# define ALIB_FEAT_BOOST_REGEX 0
381#if !defined(ALIB_DEBUG)
382# if !defined(NDEBUG) || defined(_DEBUG) || defined(DEBUG)
390 #define ALIB_DBG(...) __VA_ARGS__
391 #define ALIB_REL(...)
392 #define ALIB_REL_DBG(releaseCode, ...) __VA_ARGS__
394 #define ALIB_DBG(...)
395 #define ALIB_REL(...) __VA_ARGS__
396 #define ALIB_REL_DBG(releaseCode, ...) releaseCode
408#if !defined(ALIB_FEAT_SINGLETON_MAPPED)
410# define ALIB_FEAT_SINGLETON_MAPPED 1
412# define ALIB_FEAT_SINGLETON_MAPPED 0
417#if defined(__WCHAR_MAX__)
418 #if __WCHAR_MAX__ == 0x7FFFFFFF \
419 || __WCHAR_MAX__ == 0xFFFFFFFF
420 #define ALIB_SIZEOF_WCHAR_T 4
422 #define ALIB_SIZEOF_WCHAR_T 2
424#elif defined(_MSC_VER)
425 #define ALIB_SIZEOF_WCHAR_T 2
427# define ALIB_SIZEOF_WCHAR_T 4
432#if !defined(ALIB_CHARACTERS_WIDE)
433# if defined(_MSC_VER)
434# define ALIB_CHARACTERS_WIDE 1
436# define ALIB_CHARACTERS_WIDE 0
440#if !defined(ALIB_CHARACTERS_SIZEOF_WCHAR)
441# define ALIB_CHARACTERS_SIZEOF_WCHAR ALIB_SIZEOF_WCHAR_T
442#elif (ALIB_CHARACTERS_SIZEOF_WCHAR != 2) && (ALIB_CHARACTERS_SIZEOF_WCHAR != 4 )
443# error "Illegal value for symbol ALIB_CHARACTERS_SIZEOF_WCHAR given. Allowed is 2 or 4."
447#if !defined(ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS)
448# define ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS 0
451#if !defined(ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS)
452# define ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS 0
455#if !defined(ALIB_FEAT_BOXING_BIJECTIVE_FLOATS)
456# define ALIB_FEAT_BOXING_BIJECTIVE_FLOATS 0
460#if !defined(ALIB_DEBUG_ARRAY_COMPRESSION)
461# define ALIB_DEBUG_ARRAY_COMPRESSION ALIB_DEBUG
462#elif !ALIB_DEBUG && ALIB_DEBUG_ARRAY_COMPRESSION
463# undef ALIB_DEBUG_ARRAY_COMPRESSION
464# define ALIB_DEBUG_ARRAY_COMPRESSION 0
465# pragma message "Symbol ALIB_DEBUG_ARRAY_COMPRESSION set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
470#if !defined(ALIB_DEBUG_CRITICAL_SECTIONS)
471# define ALIB_DEBUG_CRITICAL_SECTIONS 0
472#elif !ALIB_DEBUG && ALIB_DEBUG_CRITICAL_SECTIONS
473# undef ALIB_DEBUG_CRITICAL_SECTIONS
474# define ALIB_DEBUG_CRITICAL_SECTIONS 0
475# pragma message "Symbol ALIB_DEBUG_CRITICAL_SECTIONS set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
476#elif !ALIB_THREADS && ALIB_DEBUG_CRITICAL_SECTIONS
477# undef ALIB_DEBUG_CRITICAL_SECTIONS
478# define ALIB_DEBUG_CRITICAL_SECTIONS 0
479# pragma message "Symbol ALIB_DEBUG_CRITICAL_SECTIONS set (from outside!) while module Threads is not included in the distribution. The symbol got disabled."
483#if !defined(ALIB_DEBUG_CONTAINERS)
484# define ALIB_DEBUG_CONTAINERS 0
485#elif !ALIB_DEBUG && ALIB_DEBUG_CONTAINERS
486# undef ALIB_DEBUG_CONTAINERS
487# define ALIB_DEBUG_CONTAINERS 0
488# pragma message "Symbol ALIB_DEBUG_CONTAINERS set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
492#if !defined(ALIB_DEBUG_ALLOCATIONS)
493# define ALIB_DEBUG_ALLOCATIONS 0
494#elif !ALIB_DEBUG && ALIB_DEBUG_ALLOCATIONS
495# undef ALIB_DEBUG_ALLOCATIONS
496# define ALIB_DEBUG_ALLOCATIONS 0
497# pragma message "Symbol ALIB_DEBUG_ALLOCATIONS set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
501#if !defined(ALIB_DEBUG_MONOMEM)
502# define ALIB_DEBUG_MONOMEM 0
503#elif !ALIB_DEBUG && ALIB_DEBUG_MONOMEM
504# undef ALIB_DEBUG_MONOMEM
505# define ALIB_DEBUG_MONOMEM 0
506# pragma message "Symbol ALIB_DEBUG_MONOMEM set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
509#if !defined(ALIB_DEBUG_BOXING)
510# define ALIB_DEBUG_BOXING 0
511#elif !ALIB_DEBUG && ALIB_DEBUG_BOXING
512# undef ALIB_DEBUG_BOXING
513# define ALIB_DEBUG_BOXING 0
514# pragma message "Symbol ALIB_DEBUG_BOXING set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
518#if !defined(ALIB_DEBUG_STRINGS)
519# define ALIB_DEBUG_STRINGS 0
520#elif !ALIB_DEBUG && ALIB_DEBUG_STRINGS
521# undef ALIB_DEBUG_STRINGS
522# define ALIB_DEBUG_STRINGS 0
523# pragma message "Symbol ALIB_DEBUG_STRINGS set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
527#if !defined(ALIB_DEBUG_RESOURCES)
528# define ALIB_DEBUG_RESOURCES 0
529#elif !ALIB_DEBUG && ALIB_DEBUG_RESOURCES
530# undef ALIB_DEBUG_RESOURCES
531# define ALIB_DEBUG_RESOURCES 0
532# pragma message "Symbol ALIB_DEBUG_RESOURCES set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
536#if !defined(ALOX_DBG_LOG)
537# define ALOX_DBG_LOG ALIB_DEBUG
539#if !defined(ALOX_DBG_LOG_CI)
540# define ALOX_DBG_LOG_CI ALIB_DEBUG
543#if !defined(ALOX_REL_LOG)
544# define ALOX_REL_LOG 1
546#if !defined(ALOX_REL_LOG_CI)
547# define ALOX_REL_LOG_CI 0
554 #define DOX_MARKER(marker)
559#if defined(__clang__)
560#elif defined(__INTEL_COMPILER)
561#elif defined(_MSC_VER)
562#elif defined(__GNUC__)
571#if defined ( _MSC_VER )
573# error "ALib needs C++ standard 17. Microsoft compiler < v16.8 not supported. Compilation aborted"
575# if defined(_MSVC_LANG)
576# if _MSVC_LANG < 201703L
577# error "ALib needs C++ standard 17. Wrong compilation settings given."
578# elif _MSVC_LANG == 201703L
579# define ALIB_INTERNAL_DEDUCED_CPPVER 17
580# elif _MSVC_LANG == 202002L
581# define ALIB_INTERNAL_DEDUCED_CPPVER 20
582# elif _MSVC_LANG > 202002L
583# define ALIB_INTERNAL_DEDUCED_CPPVER 23
588#elif defined(__cplusplus)
589# if __cplusplus < 201703L
590# error "ALib needs C++ 17. Compilation aborted"
592# define ALIB_INTERNAL_DEDUCED_CPPVER 17
594# if __cplusplus == 202002L
595# undef ALIB_INTERNAL_DEDUCED_CPPVER
596# define ALIB_INTERNAL_DEDUCED_CPPVER 20
598# if __cplusplus > 202002L
599# undef ALIB_INTERNAL_DEDUCED_CPPVER
600# define ALIB_INTERNAL_DEDUCED_CPPVER 23
605#if !defined(ALIB_CPP_STANDARD)
606# if defined(ALIB_INTERNAL_DEDUCED_CPPVER)
607# define ALIB_CPP_STANDARD ALIB_INTERNAL_DEDUCED_CPPVER
609# error "Unknown compiler/toolchain. Can't deduce ALIB_CPP_STANDARD. Please provide this symbol 'manually' to the compiler."
612# if defined(ALIB_INTERNAL_DEDUCED_CPPVER)
613# if (ALIB_CPP_STANDARD != ALIB_INTERNAL_DEDUCED_CPPVER)
614# error "ALIB_CPP_STANDARD was explicitly passed to the compiler, but does not match the language standard deduced by ALib."
616# elif ALIB_CPP_STANDARD != 17 && ALIB_CPP_STANDARD != 20 && ALIB_CPP_STANDARD != 23
617# error "ALIB_CPP_STANDARD must be set to 17, 20 or 23."
622#if ALIB_CPP_STANDARD != 17 && ALIB_CPP_STANDARD != 20 && ALIB_CPP_STANDARD != 23
623# error "Error in header. This must never happen."
627#if ALIB_CPP_STANDARD >= 23
628# define ALIB_CPP_23(...) __VA_ARGS__
629# define ALIB_CPP_BEFORE_23(...)
631# define ALIB_CPP_23(...)
632# define ALIB_CPP_BEFORE_23(...) __VA_ARGS__
637#if defined( _MSC_VER ) && !defined( ALIB_API_NO_DLL )
638 #ifdef ALIB_API_IS_DLL
639 #define ALIB_API __declspec(dllexport)
641 #define ALIB_API __declspec(dllimport)
649#if defined( _MSC_VER )
650# define ALIB_FORCE_INLINE __forceinline
652# define ALIB_FORCE_INLINE __attribute__((always_inline)) inline
654#define ALIB_NO_RETURN [[ noreturn ]]
660 #define ALIB_WARNINGS_UNINITIALIZED_OFF \
661 _Pragma("GCC diagnostic push") \
662 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
664 #define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING \
665 _Pragma("GCC diagnostic push") \
666 _Pragma("GCC diagnostic ignored \"-Wnonnull\"") \
668 #define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE \
669 _Pragma("GCC diagnostic push") \
671 #define ALIB_WARNINGS_ALLOW_MACRO_REDEFINITION \
672 _Pragma("GCC diagnostic push") \
674 #define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE \
675 _Pragma("GCC diagnostic push") \
677 #define ALIB_WARNINGS_MACRO_NOT_USED_OFF \
678 _Pragma("GCC diagnostic push") \
680 #define ALIB_WARNINGS_RESERVED_MACRO_NAME_OFF \
681 _Pragma("GCC diagnostic push") \
683 #define ALIB_WARNINGS_OVERLOAD_VIRTUAL_OFF \
684 _Pragma("GCC diagnostic push") \
686 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
687 _Pragma("GCC diagnostic push") \
688 _Pragma("GCC diagnostic ignored \"-Wswitch\"") \
690 #define ALIB_WARNINGS_ALLOW_BITWISE_SWITCH \
691 _Pragma("GCC diagnostic push") \
692 _Pragma("GCC diagnostic ignored \"-Wswitch\"") \
694 #define ALIB_WARNINGS_ALLOW_SHIFT_COUNT_OVERFLOW \
695 _Pragma("GCC diagnostic push") \
696 _Pragma("GCC diagnostic ignored \"-Wshift-count-overflow\"") \
698 #define ALIB_WARNINGS_IGNORE_UNUSED_MACRO \
699 _Pragma("GCC diagnostic push") \
700 _Pragma("GCC diagnostic ignored \"-Wunused-macros\"") \
702 #define ALIB_WARNINGS_IGNORE_UNUSED_PARAMETER \
703 _Pragma("GCC diagnostic push") \
704 _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
706 #define ALIB_WARNINGS_IGNORE_UNUSED_VARIABLE \
707 _Pragma("GCC diagnostic push") \
708 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
710 #define ALIB_WARNINGS_IGNORE_UNUSED_FUNCTION \
711 _Pragma("GCC diagnostic push") \
712 _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \
714 #define ALIB_WARNINGS_IGNORE_UNUSED_LAMBDA_CAPTURE \
715 _Pragma("GCC diagnostic push") \
717 #define ALIB_WARNINGS_IGNORE_FUNCTION_TEMPLATE \
718 _Pragma("GCC diagnostic push") \
720 #define ALIB_WARNINGS_IGNORE_NOTHING_RETURNED \
721 _Pragma("GCC diagnostic push") \
722 _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
724 #define ALIB_WARNINGS_IGNORE_INTEGRAL_CONSTANT_OVERFLOW \
725 _Pragma("GCC diagnostic push") \
727 #define ALIB_WARNINGS_IGNORE_RESERVED_IDENTIFIER \
728 _Pragma("GCC diagnostic push") \
730 #define ALIB_WARNINGS_IGNORE_DOCS \
731 _Pragma("GCC diagnostic push") \
733 #define ALIB_WARNINGS_IGNORE_SIGN_CONVERSION \
734 _Pragma("GCC diagnostic push") \
735 _Pragma("GCC diagnostic ignored \"-Wsign-conversion\"") \
737 #define ALIB_WARNINGS_IGNORE_INTEGER_OVERFLOW \
738 _Pragma("GCC diagnostic push") \
739 _Pragma("GCC diagnostic ignored \"-Wshift-count-overflow\"") \
741 #define ALIB_WARNINGS_RESTORE \
742 _Pragma("GCC diagnostic pop")
745 #define ALIB_FALLTHROUGH
747 #define ALIB_FALLTHROUGH [[gnu::fallthrough]];
750#elif defined(__clang__)
752 #define ALIB_WARNINGS_UNINITIALIZED_OFF \
753 _Pragma("clang diagnostic push") \
754 _Pragma("clang diagnostic ignored \"-Wuninitialized\"") \
755 _Pragma("clang diagnostic ignored \"-Wconditional-uninitialized\"") \
757 #define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING \
758 _Pragma("clang diagnostic push") \
760 #define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE \
761 _Pragma("clang diagnostic push") \
762 _Pragma("clang diagnostic ignored \"-Wunsafe-buffer-usage\"") \
764 #define ALIB_WARNINGS_OVERLOAD_VIRTUAL_OFF \
765 _Pragma("clang diagnostic push") \
766 _Pragma("clang diagnostic ignored \"-Woverloaded-virtual\"") \
768 #define ALIB_WARNINGS_ALLOW_MACRO_REDEFINITION \
769 _Pragma("clang diagnostic push") \
770 _Pragma("clang diagnostic ignored \"-Wmacro-redefined\"") \
772 #define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE \
773 _Pragma("clang diagnostic push") \
774 _Pragma("clang diagnostic ignored \"-Wunused-macros\"") \
777 #define ALIB_WARNINGS_MACRO_NOT_USED_OFF \
778 _Pragma("clang diagnostic push") \
779 _Pragma("clang diagnostic ignored \"-Wunused-macros\"") \
781 #define ALIB_WARNINGS_RESERVED_MACRO_NAME_OFF \
782 _Pragma("clang diagnostic push") \
783 _Pragma("clang diagnostic ignored \"-Wreserved-macro-identifier\"") \
785 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
786 _Pragma("clang diagnostic push") \
787 _Pragma("clang diagnostic ignored \"-Wswitch\"") \
788 _Pragma("clang diagnostic ignored \"-Wswitch-enum\"") \
790 #define ALIB_WARNINGS_ALLOW_BITWISE_SWITCH \
791 _Pragma("clang diagnostic push") \
792 _Pragma("clang diagnostic ignored \"-Wswitch\"") \
793 _Pragma("clang diagnostic ignored \"-Wcovered-switch-default\"") \
795 #define ALIB_WARNINGS_ALLOW_SHIFT_COUNT_OVERFLOW \
796 _Pragma("clang diagnostic push") \
797 _Pragma("clang diagnostic ignored \"-Wshift-count-overflow\"") \
799 #define ALIB_WARNINGS_IGNORE_UNUSED_MACRO \
800 _Pragma("clang diagnostic push") \
801 _Pragma("clang diagnostic ignored \"-Wunused-macros\"") \
803 #define ALIB_WARNINGS_IGNORE_UNUSED_PARAMETER \
804 _Pragma("clang diagnostic push") \
805 _Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \
807 #define ALIB_WARNINGS_IGNORE_UNUSED_VARIABLE \
808 _Pragma("clang diagnostic push") \
809 _Pragma("clang diagnostic ignored \"-Wunused-variable\"") \
811 #define ALIB_WARNINGS_IGNORE_UNUSED_FUNCTION \
812 _Pragma("clang diagnostic push") \
813 _Pragma("clang diagnostic ignored \"-Wunused-function\"") \
814 _Pragma("clang diagnostic ignored \"-Wunused-member-function\"") \
815 _Pragma("clang diagnostic ignored \"-Wunused-template\"") \
817 #define ALIB_WARNINGS_IGNORE_UNUSED_LAMBDA_CAPTURE \
818 _Pragma("clang diagnostic push") \
819 _Pragma("clang diagnostic ignored \"-Wunused-lambda-capture\"") \
821 #define ALIB_WARNINGS_IGNORE_FUNCTION_TEMPLATE \
822 _Pragma("clang diagnostic push") \
823 _Pragma("clang diagnostic ignored \"-Wunused-template\"") \
825 #define ALIB_WARNINGS_IGNORE_NOTHING_RETURNED \
826 _Pragma("clang diagnostic push") \
827 _Pragma("clang diagnostic ignored \"-Wreturn-type\"") \
829 #define ALIB_WARNINGS_IGNORE_INTEGRAL_CONSTANT_OVERFLOW \
830 _Pragma("clang diagnostic push") \
832 #define ALIB_WARNINGS_IGNORE_DOCS \
833 _Pragma("clang diagnostic push") \
834 _Pragma("clang diagnostic ignored \"-Wdocumentation\"") \
836 #define ALIB_WARNINGS_IGNORE_RESERVED_IDENTIFIER \
837 _Pragma("clang diagnostic push") \
838 _Pragma("clang diagnostic ignored \"-Wreserved-identifier\"") \
840 #define ALIB_WARNINGS_IGNORE_INTEGER_OVERFLOW \
841 _Pragma("clang diagnostic push") \
842 _Pragma("clang diagnostic ignored \"-Winteger-overflow\"") \
844 #define ALIB_WARNINGS_IGNORE_SIGN_CONVERSION \
845 _Pragma("clang diagnostic push") \
846 _Pragma("clang diagnostic ignored \"-Wsign-conversion\"") \
849 #define ALIB_WARNINGS_RESTORE \
850 _Pragma("clang diagnostic pop") \
852 #define ALIB_FALLTHROUGH [[clang::fallthrough]];
855#elif defined(_MSC_VER)
856 #define ALIB_WARNINGS_UNINITIALIZED_OFF \
857 __pragma(warning( push )) \
858 __pragma(warning( disable : 4701 )) \
860 #define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING \
861 __pragma(warning( push )) \
863 #define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE \
864 __pragma(warning( push )) \
866 #define ALIB_WARNINGS_MACRO_NOT_USED_OFF \
867 __pragma(warning( push )) \
869 #define ALIB_WARNINGS_RESERVED_MACRO_NAME_OFF \
870 __pragma(warning( push )) \
872 #define ALIB_WARNINGS_OVERLOAD_VIRTUAL_OFF \
873 __pragma(warning( push )) \
875 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
876 __pragma(warning( push )) \
878 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
879 __pragma(warning( push )) \
881 #define ALIB_WARNINGS_ALLOW_MACRO_REDEFINITION \
882 __pragma(warning( push )) \
883 __pragma(warning( disable : 4005 )) \
885 #define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE \
886 __pragma(warning( push )) \
887 __pragma(warning( disable : 4996 )) \
889 #define ALIB_WARNINGS_ALLOW_BITWISE_SWITCH \
890 __pragma(warning( push )) \
892 #define ALIB_WARNINGS_ALLOW_SHIFT_COUNT_OVERFLOW \
893 __pragma(warning( push )) \
895 #define ALIB_WARNINGS_IGNORE_UNUSED_MACRO \
896 __pragma(warning( push )) \
898 #define ALIB_WARNINGS_IGNORE_UNUSED_PARAMETER \
899 __pragma(warning( push )) \
901 #define ALIB_WARNINGS_IGNORE_UNUSED_VARIABLE \
902 __pragma(warning( push )) \
904 #define ALIB_WARNINGS_IGNORE_UNUSED_FUNCTION \
905 __pragma(warning( push )) \
907 #define ALIB_WARNINGS_IGNORE_UNUSED_LAMBDA_CAPTURE \
908 __pragma(warning( push )) \
910 #define ALIB_WARNINGS_IGNORE_FUNCTION_TEMPLATE \
911 __pragma(warning( push )) \
913 #define ALIB_WARNINGS_IGNORE_NOTHING_RETURNED \
914 __pragma(warning( push )) \
915 __pragma(warning( disable : 4715 )) \
917 #define ALIB_WARNINGS_IGNORE_INTEGRAL_CONSTANT_OVERFLOW \
918 __pragma(warning( push )) \
919 __pragma(warning( disable : 4305 )) \
920 __pragma(warning( disable : 4307 )) \
921 __pragma(warning( disable : 4309 )) \
922 __pragma(warning( disable : 4310 )) \
923 __pragma(warning( disable : 4293 )) \
925 #define ALIB_WARNINGS_IGNORE_INTEGER_OVERFLOW \
926 __pragma(warning( push )) \
927 __pragma(warning( disable : 4293 )) \
929 #define ALIB_WARNINGS_IGNORE_RESERVED_IDENTIFIER \
930 __pragma(warning( push )) \
932 #define ALIB_WARNINGS_IGNORE_DOCS \
933 __pragma(warning( push )) \
935 #define ALIB_WARNINGS_IGNORE_SIGN_CONVERSION \
936 __pragma(warning( push )) \
938 #define ALIB_WARNINGS_IGNORE_DOCS \
939 __pragma(warning( push )) \
941 #define ALIB_WARNINGS_RESTORE \
942 __pragma(warning( pop )) \
944 #define ALIB_FALLTHROUGH
947 #define ALIB_WARNINGS_RESTORE
948 #define ALIB_FALLTHROUGH
955# define ALIB_NSTRINGIFY(a)
956# define ALIB_STRINGIFY(a)
958# define ALIB_STRINGIFY_X(a) A_CHAR( #a )
959# define ALIB_STRINGIFY(a) ALIB_STRINGIFY_X(a)
960# define ALIB_NSTRINGIFY_X(a) #a
961# define ALIB_NSTRINGIFY(a) ALIB_NSTRINGIFY_X(a)
967#define ALIB_CONCAT_IMPL(a,b) a ## b
969#define ALIB_CONCAT(a,b) ALIB_CONCAT_IMPL(a,b)
971#if defined(__clang__)
972# define ALIB_IDENTIFIER(prefix) ALIB_WARNINGS_IGNORE_RESERVED_IDENTIFIER \
973 ALIB_CONCAT(prefix, __LINE__) \
974 ALIB_WARNINGS_RESTORE
976# define ALIB_IDENTIFIER(prefix) ALIB_CONCAT(prefix, __LINE__)
984# define ALIB_COMMA_DBG ,
986# define ALIB_COMMA_DBG
990#define ALIB_STATIC_ASSERT( CondVariable, Cond, Message ) \
991{ constexpr bool CondVariable= Cond; \
992 static_assert( CondVariable, Message ); } \
994#define ALIB_STATIC_DENY( CondVariable, Cond, Message ) \
995{ constexpr bool CondVariable= !(Cond); \
996 static_assert( CondVariable, Message ); } \
1001struct ALibTestGlobalNamespace;
1002#define ALIB_ASSERT_GLOBAL_NAMESPACE \
1003struct ALibTestGlobalNamespace; \
1004static_assert(std::is_same<ALibTestGlobalNamespace, ::ALibTestGlobalNamespace>::value, \
1005 "This is not the global namespace!");
1030#define ALIB_STACK_ALLOCATED_TYPE(T) \
1031private: void* operator new (size_t); \
1032 void* operator new (size_t, void*); \
1033 void* operator new[](size_t); \
1034 void* operator new[](size_t, void*); \
1037 void operator=(const T& ); \
1038 void operator=( T&& );
1040#include <type_traits>
1049 template<
typename T>
inline constexpr bool IsNull(
const T& t);
1054 template<
typename T>
inline constexpr bool IsNotNull(
const T& t) {
return t==T(); }
1060 template<
typename T>
inline constexpr void SetNull(
const T& t);
1062 template<
typename T>
1064 typename std::enable_if_t<std::is_default_constructible_v<T>,
bool>
1065 IsNull(
const T& t) {
return t==T(); }
1067 template<
typename T>
1069 typename std::enable_if_t<std::is_default_constructible_v<T>,
bool>
1070 IsNotNull(
const T& t) {
return t!=T(); }
1072 template<
typename T>
1074 typename std::enable_if_t<std::is_default_constructible_v<T>,
void>
1094struct NC :
public std::false_type {};
1097struct CHK :
public std::true_type {};
1105#if ALIB_EXT_LIB_THREADS_AVAILABLE
1110namespace alib {
namespace lang {
1135 #if ALIB_EXT_LIB_THREADS_AVAILABLE
1147# if ALIB_DEBUG && !ALIB_THREADS && ALIB_EXT_LIB_THREADS_AVAILABLE
1157#if defined ( _MSC_VER )
1158# define ALIB_CALLER_FUNC __FUNCTION__
1160# define ALIB_CALLER_FUNC __func__
1163#if ALIB_EXT_LIB_THREADS_AVAILABLE
1164# define ALIB_CALLER {__FILE__,__LINE__,ALIB_CALLER_FUNC,::std::this_thread::get_id(),&typeid(*this)}
1166# define ALIB_CALLER {__FILE__,__LINE__,ALIB_CALLER_FUNC,&typeid(*this)}
1170# define ALIB_CALLER_PRUNED ALIB_CALLER
1171# define ALIB_COMMA_CALLER_PRUNED , ALIB_CALLER
1172# define ALIB_CALLER_PRUNED_COMMA ALIB_CALLER ,
1173# define ALIB_CALLER_NULLED ALIB_CALLER
1174# define ALIB_COMMA_CALLER_NULLED , ALIB_CALLER
1175# define ALIB_CALLER_NULLED_COMMA ALIB_CALLER ,
1176# define ALIB_DBG_TAKE_CI const CallerInfo& ci
1178# define ALIB_CALLER_PRUNED
1179# define ALIB_COMMA_CALLER_PRUNED
1180# define ALIB_CALLER_PRUNED_COMMA
1181# if ALIB_EXT_LIB_THREADS_AVAILABLE
1182# define ALIB_CALLER_NULLED {nullptr,0,nullptr,::std::thread::id(), nullptr}
1183# define ALIB_COMMA_CALLER_NULLED , {nullptr,0,nullptr,::std::thread::id(), nullptr}
1184# define ALIB_CALLER_NULLED_COMMA {nullptr,0,nullptr,::std::thread::id(), nullptr} ,
1186# define ALIB_CALLER_NULLED {nullptr,0,nullptr,nullptr}
1187# define ALIB_COMMA_CALLER_NULLED , {nullptr,0,nullptr,nullptr}
1188# define ALIB_CALLER_NULLED_COMMA {nullptr,0,nullptr,nullptr} ,
1190# define ALIB_DBG_TAKE_CI
1197#if !defined (_ASSERT_H) && !defined(assert)
1224 const char* msg1=
nullptr,
1225 const char* msg2=
nullptr,
1226 const char* msg3=
nullptr,
1227 const char* msg4=
nullptr,
1228 const char* msg5=
nullptr );
1246 const int intValue );
1259 int type ,
const char* topic,
1260 int qtyMsgs,
const char** msgs );
1267#define ALIB_ERROR( ...) { alib::lang::DbgSimpleALibMsg( ALIB_CALLER_PRUNED , 0, __VA_ARGS__); }
1268#define ALIB_WARNING( ...) { alib::lang::DbgSimpleALibMsg( ALIB_CALLER_PRUNED , 1, __VA_ARGS__); }
1269#define ALIB_MESSAGE( ...) { alib::lang::DbgSimpleALibMsg( ALIB_CALLER_PRUNED , 2, __VA_ARGS__); }
1270#define ALIB_ASSERT( cond) { if( !( cond)) ALIB_ERROR ( "Assertion Failed" ); }
1271#define ALIB_ASSERT_ERROR( cond, ...) { if( !( cond)) ALIB_ERROR ( __VA_ARGS__ ); }
1272#define ALIB_ASSERT_WARNING( cond, ...) { if( !( cond)) ALIB_WARNING ( __VA_ARGS__ ); }
1273#define ALIB_ASSERT_MESSAGE( cond, ...) { if( !( cond)) ALIB_MESSAGE ( __VA_ARGS__ ); }
1276 #define ALIB_ERROR( ... ) { }
1277 #define ALIB_WARNING( ... ) { }
1278 #define ALIB_MESSAGE( ... ) { }
1279 #define ALIB_ASSERT( cond ) { }
1280 #define ALIB_ASSERT_ERROR( cond, ...) { }
1281 #define ALIB_ASSERT_WARNING( cond, ...) { }
1282 #define ALIB_ASSERT_MESSAGE( cond, ...) { }
1286 #define ALIB_ASSERT_RESULT_EQUALS( func, value ) { auto result= func; assert(result == value); ((void) result); }
1287 #define ALIB_ASSERT_RESULT_NOT_EQUALS( func, value ) { auto result= func; assert(result != value); ((void) result); }
1288 #define ALIB_ASSERT_RESULT_GREATER_THAN(func, value ) { auto result= func; assert(result > value); ((void) result); }
1289 #define ALIB_ASSERT_RESULT_LESS_THAN( func, value ) { auto result= func; assert(result < value); ((void) result); }
1291 #define ALIB_ASSERT_RESULT_EQUALS( func, value ) { func; }
1292 #define ALIB_ASSERT_RESULT_NOT_EQUALS( func, value ) { func; }
1293 #define ALIB_ASSERT_RESULT_GREATER_THAN(func, value ) { func; }
1294 #define ALIB_ASSERT_RESULT_LESS_THAN( func, value ) { func; }
1318# define ALIB_COMPILATION_FLAGS \
1319 + (1<<0) * ALIB_ALOX \
1320 + (1<<1) * ALIB_BITBUFFER \
1321 + (1<<2) * ALIB_BOXING \
1322 + (1<<3) * ALIB_CAMP \
1323 + (1<<4) * ALIB_CHARACTERS \
1324 + (1<<5) * ALIB_CLI \
1325 + (1<<6) * ALIB_CONFIGURATION \
1326 + (1<<7) * ALIB_CONTAINERS \
1328 + (1<<0) * ALIB_ENUMS \
1329 + (1<<1) * ALIB_EXPRESSIONS \
1330 + (1<<2) * ALIB_FILES \
1331 + (1<<3) * ALIB_MONOMEM \
1332 + (1<<4) * ALIB_SINGLETONS \
1333 + (1<<5) * ALIB_STRINGS \
1334 + (1<<6) * ALIB_THREADMODEL \
1335 + (1<<7) * ALIB_THREADS \
1337 + (1<<0) * ALIB_TIME \
1338 + (1<<7) * ALIB_DEBUG \
1340 + (1<<0) * ALIB_DEBUG_ARRAY_COMPRESSION \
1341 + (1<<1) * ALIB_DEBUG_ALLOCATIONS \
1342 + (1<<2) * ALIB_DEBUG_BOXING \
1343 + (1<<3) * ALIB_DEBUG_CONTAINERS \
1344 + (1<<4) * ALIB_DEBUG_CRITICAL_SECTIONS \
1345 + (1<<5) * ALIB_DEBUG_MONOMEM \
1346 + (1<<6) * ALIB_DEBUG_STRINGS \
1347 + (1<<7) * ALIB_DEBUG_RESOURCES \
1349 + (1<<0) * ALIB_FEAT_SINGLETON_MAPPED \
1350 + (1<<1) * ALIB_CHARACTERS_WIDE \
1351 + (1<<2) * (ALIB_CHARACTERS_SIZEOF_WCHAR == 4 ? 1 : 0) \
1352 + (1<<3) * ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS \
1353 + (1<<4) * ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS \
1354 + (1<<5) * ALIB_FEAT_BOXING_BIJECTIVE_FLOATS \
1355 + (1<<6) * ALIB_FEAT_BOOST_REGEX \
1357 + (1<<0) * ALOX_DBG_LOG \
1358 + (1<<1) * ALOX_DBG_LOG_CI \
1359 + (1<<2) * ALOX_REL_LOG \
1360 + (1<<3) * ALOX_REL_LOG_CI \
1389 TCompilationFlags compilationFlags = TCompilationFlags{ALIB_COMPILATION_FLAGS});
1426namespace lang {
class Camp; }
1428 lang::Camp* targetCamp =
nullptr,
1431 TCompilationFlags compilationFlags = TCompilationFlags{ALIB_COMPILATION_FLAGS} );
1434 lang::Camp* targetCamp =
nullptr );
#define ALIB_SIZEOF_WCHAR_T
constexpr bool IsNotNull(const T &t)
constexpr bool IsNull(const T &t)
constexpr void SetNull(const T &t)
ALIB_API void DbgSimpleALibMsg(const CallerInfo &ci, int type, const char *topic, const char *msg1=nullptr, const char *msg2=nullptr, const char *msg3=nullptr, const char *msg4=nullptr, const char *msg5=nullptr)
void(* DBG_SIMPLE_ALIB_MSG_PLUGIN)(const CallerInfo &ci, int type, const char *topic, int qtyMsgs, const char **msgs)
ShutdownPhases
Termination levels usable with Bootstrapping ALib Camps.
@ Destruct
The main phase of termination that destructs everything.
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE void AssertALibVersionAndFlags(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
CompilationFlagMeaningsEntry COMPILATION_FLAG_MEANINGS[37]
BootstrapPhases
Initialization levels usable with Bootstrapping ALib Camps.
@ Final
The final initialization phase. Here, camps are initializing their custom setup.
bool NonCampModulesInitialized
ALIB_WARNINGS_RESTORE void Bootstrap(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
void DbgAssertSingleThreaded()
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE TCompilationFlags COMPILATION_FLAGS
This is a struct composing an entry in COMPILATION_FLAG_MEANINGS.
const char * Name
The human-readable meaning of the bit.
int Flag
The bit number in the bitset.
unsigned char bits[6]
The Flags.
std::thread::id ThreadID
The ID of the calling thread.
const std::type_info * TypeInfo
The calling type.
int Line
The line number within File.