18 auto sz =
sizeof(
"type_name_f") - 1;
20 string_view p = __PRETTY_FUNCTION__;
22 return string_view(p.data() + begin, p.size() - begin - 1);
23# elif defined(__GNUC__)
24 string_view p = __PRETTY_FUNCTION__;
25# ifdef __INTEL_COMPILER
27 return string_view(p.data() + begin, p.size() - begin - 1);
28# elif __cplusplus < 201402
30 return string_view(p.data() + begin, p.size() - begin - 1);
33 return string_view(p.data() + begin, p.find(
';', begin) - begin);
35# elif defined(_MSC_VER)
36 string_view p = __FUNCSIG__;
38 return string_view(p.data() + begin, p.size() - begin - 7);
41static_assert(type_name_f<char>() ==
"char");
65 constexpr auto operator->() const noexcept ->
int* {
return p; }
68constexpr auto test() noexcept ->
bool {
76static_assert(
test(),
"");
78auto test(std::streamsize s) ->
void { std::cout << s <<
'\n'; }
83 for (
unsigned b = 0; b < 62; ++b) {
84 std::uint64_t i = 1ull << b;
85 std::pair<int, int> lengths[] = {
89 for (
auto test : lengths) {
91 std::cout <<
"count_digits failure at: " << i <<
".\nExpected "
92 <<
test.first <<
", got " <<
test.second <<
".\n";
Provides generic operations for containers, as well as kblib::stack.
Provides some basic interfaces to make using ICU smoother.
Includes most other headers in kblib.
KBLIB_UNUSED constexpr const char type_name< signed char >[]
KBLIB_UNUSED constexpr const char type_name< char >[]
constexpr auto type_name_f() -> std::string_view
KBLIB_UNUSED constexpr const char type_name< unsigned char >[]
constexpr auto test() noexcept -> bool
constexpr const char type_name[]
constexpr auto to_pointer(P &&p) noexcept -> auto *
Gets a raw pointer out of any smart pointer or iterator you might pass in, without dereferencing it o...
auto to_string(Int num) -> std::string
constexpr auto count_digits(Number val) -> enable_if_t< std::is_floating_point< Number >::value, int >
Calculates the number of decimal digits needed to represent a number, plus one for negative numbers.
constexpr auto operator->() const noexcept -> int *
constexpr auto operator->() const noexcept -> bad_iterator< depth - 1 >
#define KBLIB_UNUSED
This internal macro is used to provide a fallback for [[maybe_unused]] in C++14.