35#if __has_include(<version>)
39#if __cplusplus < 201402L
40# error kblib requires C++14 or higher
45#define KBLIB_VERS_MAJ 00
46#define KBLIB_VERS_MIN 04
47#define KBLIB_VERS_REV 02
48#define KBLIB_VERS_I(P, MAJ, MIN, REV) KBLIB_VERS_I2(P, MAJ, MIN, REV)
49#define KBLIB_VERS_I2(P, MAJ, MIN, REV) P##MAJ##MIN##REV
53 KBLIB_VERS_I(KBV, KBLIB_VERS_MAJ, KBLIB_VERS_MIN, KBLIB_VERS_REV)
56 KBLIB_VERS_I(1, KBLIB_VERS_MAJ, KBLIB_VERS_MIN, KBLIB_VERS_REV)
63#if (__cplusplus >= 201703L)
64# define KBLIB_USE_CXX17 1
66# define KBLIB_USE_CXX17 0
74#if (__cplusplus >= 202002L)
75# define KBLIB_USE_CXX20 1
77# define KBLIB_USE_CXX20 0
84#ifndef KBLIB_USE_STRING_VIEW
86# define KBLIB_USE_STRING_VIEW 1
88# define KBLIB_USE_STRING_VIEW 0
97#ifndef KBLIB_USE_SPANSTREAM
98# if __cpp_lib_spanstream
99# define KBLIB_USE_SPANSTREAM 1
101# define KBLIB_USE_SPANSTREAM 0
110# define KBLIB_CXX20(args) args
112# define KBLIB_CXX20(args)
116#define KBLIB_VERS_NS_I(VS, CXX17, CXX_SV, CXX_SS, CXX20) \
117 KBLIB_VERS_NS_I2(VS, CXX17, CXX_SV, CXX_SS, CXX20)
118#define KBLIB_VERS_NS_I2(VS, CXX17, CXX_SV, CXX_SS, CXX20) \
119 VS##_##CXX17##CXX_SV##CXX_SS##CXX20
121#define KBLIB_VERS_NS \
122 KBLIB_VERS_NS_I(KBLIB_VERS_S, KBLIB_USE_CXX17, KBLIB_USE_STRING_VIEW, \
123 KBLIB_USE_SPANSTREAM, KBLIB_USE_CXX20)
126# define KBLIB_NS KBLIB_VERS_NS
130# define KBLIB_NS kblib
146# define KBLIB_NODISCARD [[nodiscard]]
147# define KBLIB_UNUSED [[maybe_unused]]
149# define KBLIB_NODISCARD [[gnu::warn_unused_result]]
150# define KBLIB_UNUSED [[gnu::unused]]
154# define KBLIB_CONSTANT constexpr inline
155# define KBLIB_CONSTANT_V constexpr inline bool
156# define KBLIB_CONSTANT_M constexpr inline static
157# define KBLIB_CONSTANT_MV constexpr inline static bool
159# define KBLIB_CONSTANT constexpr
160# define KBLIB_CONSTANT_V constexpr bool
161# define KBLIB_CONSTANT_M constexpr static
162# define KBLIB_CONSTANT_MV constexpr static bool
165#if defined(_DOXYGEN_) and not defined(KBLIB_DEF_MACROS)
171# define KBLIB_DEF_MACROS
189 template <
typename Container, bool,
typename...>
192 template <
typename T>
197 template <
typename T>
202 template <
typename T>
207 template <
typename T>
216 if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) {
218 }
else if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) {
219 return endian::little;
221 return endian::weird;
236 return endian::little;
241#ifdef KBLIB_CONSISTENT_HASHES
250using byte =
unsigned char;
constexpr auto get_hash_order() -> endian
typename no_dangle< T >::type no_dangle_t
The main namespace in which all entities from kblib are defined.
constexpr endian system_endian
constexpr endian hash_order
#define KBLIB_NODISCARD
This internal macro is used to provide a fallback for [[nodiscard]] in C++14.