\hypertarget{convert_8h_source}{}\doxysection{convert.\+h} \label{convert_8h_source}\index{kblib/convert.h@{kblib/convert.h}} \mbox{\hyperlink{convert_8h}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00001}00001 \textcolor{comment}{/* *****************************************************************************}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00002}00002 \textcolor{comment}{ * kblib is a general utility library for C++14 and C++17, intended to provide}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00003}00003 \textcolor{comment}{ * performant high-\/level abstractions and more expressive ways to do simple}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00004}00004 \textcolor{comment}{ * things.}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00005}00005 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2021 killerbee}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00007}00007 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00008}00008 \textcolor{comment}{ * This program is free software: you can redistribute it and/or modify}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00009}00009 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00010}00010 \textcolor{comment}{ * the Free Software Foundation, either version 3 of the License, or}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00011}00011 \textcolor{comment}{ * (at your option) any later version.}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00012}00012 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00013}00013 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00014}00014 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00015}00015 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00016}00016 \textcolor{comment}{ * GNU General Public License for more details.}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00017}00017 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00018}00018 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00019}00019 \textcolor{comment}{ * along with this program. If not, see .}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00020}00020 \textcolor{comment}{ * ****************************************************************************/}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00021}00021 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00032}00032 \textcolor{preprocessor}{\#if KBLIB\_DEF\_MACROS and not defined(pFromStr)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00033}\mbox{\hyperlink{convert_8h_a6dd7941ecece3eeaa1b4ac149a48de36}{00033}} \textcolor{preprocessor}{\# define pFromStr(type, val) ::kblib::fromStr((val), \# type)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00034}00034 \textcolor{preprocessor}{\#endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00035}00035 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00036}00036 \textcolor{preprocessor}{\#ifndef KBLIB\_CONVERT\_H}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00037}00037 \textcolor{preprocessor}{\# define KBLIB\_CONVERT\_H}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00038}00038 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00039}00039 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00040}00040 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00041}00041 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00042}00042 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00043}00043 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00044}00044 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00045}00045 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00046}00046 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00047}00047 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00048}00048 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00049}00049 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00050}00050 \textcolor{preprocessor}{\# include "{}\mbox{\hyperlink{algorithm_8h}{algorithm.h}}"{}}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00051}00051 \textcolor{preprocessor}{\# include "{}\mbox{\hyperlink{iterators_8h}{iterators.h}}"{}}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00052}00052 \textcolor{preprocessor}{\# include "{}\mbox{\hyperlink{traits_8h}{traits.h}}"{}}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00053}00053 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00054}00054 \textcolor{preprocessor}{\# if KBLIB\_USE\_STRING\_VIEW}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00055}00055 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00056}00056 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00057}00057 \textcolor{preprocessor}{\# pragma GCC diagnostic push}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00058}00058 \textcolor{preprocessor}{\# pragma GCC diagnostic ignored "{}-\/W\#warnings"{}}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00059}00059 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00060}00060 \textcolor{preprocessor}{\# pragma GCC diagnostic pop}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00061}00061 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00062}00062 \textcolor{preprocessor}{\# include "{}\mbox{\hyperlink{stringops_8h}{stringops.h}}"{}}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00063}00063 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00064}00064 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00065}00065 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00066}00066 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00067}00067 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00068}00068 \textcolor{keyword}{namespace }\mbox{\hyperlink{tdecl_8h_a4b5c574c663a392148218cd4410fd7a1}{KBLIB\_NS}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00069}00069 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00070}00070 \textcolor{keyword}{template} <\textcolor{keywordtype}{int} base, \textcolor{keyword}{typename} Int>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00071}\mbox{\hyperlink{namespacekblib_a9d7e23caee89855a71fb84c7f245f977}{00071}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ad4d84a46d50ba8ad780b5d12ec029225}{to\_string}}(Int num) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00072}00072 \textcolor{keyword}{static\_assert}(base <= 62 and base > 0, \textcolor{stringliteral}{"{}Supported bases are 1 thru 62."{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00073}00073 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} digits = \mbox{\hyperlink{namespacekblib_a9bfc51ee4b1118cf5effed3d4ae9dfed}{remove\_null\_terminator}}(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00074}00074 \textcolor{stringliteral}{"{}0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00075}00075 std::string ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00076}00076 \textcolor{keywordtype}{bool} neg = \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00077}00077 \textcolor{keywordflow}{if} (num < 0) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00078}00078 neg = \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00079}00079 num *= -\/1;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00080}00080 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (num == 0) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00081}00081 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}0"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00082}00082 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00083}00083 \textcolor{keywordflow}{do} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00084}00084 ret.push\_back(digits[num \% base]);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00085}00085 \} \textcolor{keywordflow}{while} (num /= base);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00086}00086 \textcolor{keywordflow}{if} (neg) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00087}00087 ret.push\_back(\textcolor{charliteral}{'-\/'});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00088}00088 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00089}00089 std::reverse(ret.begin(), ret.end());} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00090}00090 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00091}00091 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00092}00092 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00093}00093 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Int>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00094}\mbox{\hyperlink{namespacekblib_ad4d84a46d50ba8ad780b5d12ec029225}{00094}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ad4d84a46d50ba8ad780b5d12ec029225}{to\_string}}(Int num, \textcolor{keywordtype}{int} base) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00095}00095 assert(base <= 62 and base > 0);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00096}00096 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} digits = \mbox{\hyperlink{namespacekblib_a9bfc51ee4b1118cf5effed3d4ae9dfed}{remove\_null\_terminator}}(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00097}00097 \textcolor{stringliteral}{"{}0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00098}00098 std::string ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00099}00099 \textcolor{keywordtype}{bool} neg = \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00100}00100 \textcolor{keywordflow}{if} (num < 0) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00101}00101 neg = \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00102}00102 num *= -\/1;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00103}00103 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (num == 0) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00104}00104 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}0"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00105}00105 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00106}00106 \textcolor{keywordflow}{do} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00107}00107 ret.push\_back(digits[num \% base]);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00108}00108 \} \textcolor{keywordflow}{while} (num /= base);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00109}00109 \textcolor{keywordflow}{if} (neg) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00110}00110 ret.push\_back(\textcolor{charliteral}{'-\/'});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00111}00111 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00112}00112 std::reverse(ret.begin(), ret.end());} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00113}00113 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00114}00114 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00115}00115 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00119}\mbox{\hyperlink{namespacekblib_1_1detail__convert}{00119}} \textcolor{keyword}{namespace }detail\_convert \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00120}00120 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00121}00121 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Result, \textcolor{keywordtype}{unsigned} variants, std::\textcolor{keywordtype}{size\_t} N>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00122}\mbox{\hyperlink{namespacekblib_1_1detail__convert_a08f4032807044ecd2d233574c3b31781}{00122}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__convert_a08f4032807044ecd2d233574c3b31781}{read\_digits}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char}* begin,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00123}00123 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* end, \textcolor{keywordtype}{unsigned} base,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00124}00124 \textcolor{keyword}{const} \textcolor{keywordtype}{char} (\&digits)[N])} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00125}00125 -\/> Result \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00126}00126 \textcolor{keywordflow}{if} (begin == end) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00127}00127 \textcolor{keywordflow}{throw} std::invalid\_argument(\textcolor{stringliteral}{"{}\(\backslash\)"{}\(\backslash\)"{} is not an integer"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00128}00128 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00129}00129 Result result\{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00130}00130 \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} c : \mbox{\hyperlink{namespacekblib_a893a2961c20b0657dffbbd2fe8f362c4}{indirect}}(begin, end)) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00131}00131 \textcolor{keywordflow}{if} (c != \textcolor{charliteral}{'\(\backslash\)''}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00132}00132 result *= base;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00133}00133 \textcolor{keyword}{auto} pos = \mbox{\hyperlink{namespacekblib_a6cc206fcdb4a68b8cb6e393b5039a575}{find\_in}}(std::begin(digits),} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00134}00134 std::begin(digits) + base * variants, c);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00135}00135 \textcolor{keywordflow}{if} (pos != base * variants) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00136}00136 result += pos / variants;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00137}00137 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00138}00138 \textcolor{keywordflow}{throw} std::invalid\_argument(\textcolor{stringliteral}{"{}invalid character in integer"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00139}00139 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00140}00140 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00141}00141 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00142}00142 \textcolor{keywordflow}{return} result;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00143}00143 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00144}00144 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00145}00145 \} \textcolor{comment}{// namespace detail\_convert}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00146}00146 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00147}00147 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Result>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00148}\mbox{\hyperlink{namespacekblib_a269228ff0b3ecfd65167e5b4420a85b5}{00148}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a58a6e469a0449b408a7fbaf12bc49551}{parse\_integer}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char}* begin, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* end,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00149}00149 \textcolor{keywordtype}{int} base = 0) -\/> Result \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00150}00150 \textcolor{keywordflow}{if} (begin == end) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00151}00151 \textcolor{keywordflow}{throw} std::invalid\_argument(\textcolor{stringliteral}{"{}\(\backslash\)"{}\(\backslash\)"{} is not an integer"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00152}00152 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (*begin == \textcolor{charliteral}{'-\/'}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00153}00153 \textcolor{keywordflow}{return} -\/parse\_integer(begin + 1, end, base);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00154}00154 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (base == 0) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00155}00155 \textcolor{keywordflow}{if} (*begin == \textcolor{charliteral}{'0'}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00156}00156 \textcolor{keywordflow}{if} (begin + 1 == end) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00157}00157 \textcolor{keywordflow}{return} 0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00158}00158 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (begin[1] == \textcolor{charliteral}{'-\/'} or (begin + 2 != end and begin[2] == \textcolor{charliteral}{'-\/'})) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00159}00159 \textcolor{keywordflow}{throw} std::invalid\_argument(\textcolor{stringliteral}{"{}unexpected -\/ in integer"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00160}00160 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00161}00161 \textcolor{keywordflow}{switch} (begin[1]) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00162}00162 \textcolor{keywordflow}{case} \textcolor{charliteral}{'x'}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00163}00163 \textcolor{keywordflow}{return} parse\_integer(begin + 2, end, 16);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00164}00164 \textcolor{keywordflow}{case} \textcolor{charliteral}{'b'}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00165}00165 \textcolor{keywordflow}{return} parse\_integer(begin + 2, end, 2);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00166}00166 \textcolor{keywordflow}{default}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00167}00167 \textcolor{keywordflow}{return} parse\_integer(begin + 1, end, 8);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00168}00168 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00169}00169 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00170}00170 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00171}00171 \textcolor{keywordflow}{return} parse\_integer(begin, end, 10);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00172}00172 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00173}00173 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00174}00174 \textcolor{keywordflow}{if} (base < 2 or base > 62) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00175}00175 \textcolor{keywordflow}{throw} std::invalid\_argument(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00176}00176 \textcolor{stringliteral}{"{}base must be either 0 or a positive number between 2 and 62"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00177}00177 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (base <= 36) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00178}00178 \textcolor{keywordflow}{return} detail\_convert::read\_digits(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00179}00179 begin, end, \mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(base),} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00180}00180 \textcolor{stringliteral}{"{}00112233445566778899AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRr"{}}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00181}00181 \textcolor{stringliteral}{"{}SsTtUuVvWwXxYyZz"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00182}00182 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (base <= 62) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00183}00183 \textcolor{keywordflow}{return} detail\_convert::read\_digits(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00184}00184 begin, end, \mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(base),} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00185}00185 \textcolor{stringliteral}{"{}0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00186}00186 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00187}00187 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00188}00188 \textcolor{comment}{// silence warning that control may flow off the end even though all paths}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00189}00189 \textcolor{comment}{// return or throw}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00190}00190 \textcolor{keywordflow}{return} 0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00191}00191 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00192}00192 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00193}00193 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Result, std::\textcolor{keywordtype}{size\_t} N>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00194}\mbox{\hyperlink{namespacekblib_a285ebb5d09f6f36d091e1c25293969d9}{00194}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a58a6e469a0449b408a7fbaf12bc49551}{parse\_integer}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} (\&in)[N], \textcolor{keywordtype}{int} base = 0)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00195}00195 -\/> Result \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00196}00196 \textcolor{keywordtype}{char} t = in[N -\/ 1];} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00197}00197 \textcolor{keywordflow}{return} parse\_integer(std::begin(in), std::end(in) -\/ +(t == \textcolor{charliteral}{'\(\backslash\)0'}),} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00198}00198 base);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00199}00199 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00200}00200 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00201}00201 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Result>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00202}\mbox{\hyperlink{namespacekblib_a85f95750656f07f1a99315e67cdb359e}{00202}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a58a6e469a0449b408a7fbaf12bc49551}{parse\_integer}}(\textcolor{keyword}{const} std::string\& in,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00203}00203 \textcolor{keywordtype}{int} base = 0) -\/> Result \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00204}00204 \textcolor{keywordflow}{return} parse\_integer(\mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{to\_pointer}}(begin(in)), \mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{to\_pointer}}(end(in)),} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00205}00205 base);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00206}00206 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00207}00207 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00208}00208 \textcolor{preprocessor}{\# if KBLIB\_USE\_STRING\_VIEW}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00209}00209 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00210}00210 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Result>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00211}\mbox{\hyperlink{namespacekblib_a58a6e469a0449b408a7fbaf12bc49551}{00211}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a58a6e469a0449b408a7fbaf12bc49551}{parse\_integer}}(std::string\_view in, \textcolor{keywordtype}{int} base = 0)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00212}00212 -\/> Result \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00213}00213 \textcolor{keywordflow}{return} parse\_integer(\mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{to\_pointer}}(begin(in)), \mbox{\hyperlink{namespacekblib_a1c2aa67048789f77bea56734a583d3d1}{to\_pointer}}(end(in)),} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00214}00214 base);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00215}00215 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00216}00216 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00217}00217 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00218}00218 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00219}00219 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T, T V>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00220}\mbox{\hyperlink{structkblib_1_1constant}{00220}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1constant}{constant}} : std::integral\_constant \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00221}\mbox{\hyperlink{structkblib_1_1constant_ac099631ec57f771e3617defdba7daa5f}{00221}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1constant_ac099631ec57f771e3617defdba7daa5f}{operator-\/}}() -\/> \mbox{\hyperlink{structkblib_1_1constant}{constant}} \{ \textcolor{keywordflow}{return} \{\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00222}\mbox{\hyperlink{structkblib_1_1constant_a4304dabd90c1d8a5c3d43c9bbbc52c5c}{00222}} \textcolor{keyword}{constexpr} \mbox{\hyperlink{structkblib_1_1constant_a4304dabd90c1d8a5c3d43c9bbbc52c5c}{constant}}() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00223}\mbox{\hyperlink{structkblib_1_1constant_a0304c07a44c41c8d043bb16c1f9f79ae}{00223}} \textcolor{keyword}{constexpr} \textcolor{comment}{/* implicit */} \mbox{\hyperlink{structkblib_1_1constant_a0304c07a44c41c8d043bb16c1f9f79ae}{constant}}(std::integral\_constant) \textcolor{keyword}{noexcept} \{\}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00224}00224 \textcolor{comment}{// reverse conversion handled by slicing}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00225}00225 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00226}00226 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00227}\mbox{\hyperlink{namespacekblib_1_1literals}{00227}} \textcolor{keyword}{inline} \textcolor{keyword}{namespace }literals \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00228}00228 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00229}00229 \textcolor{keyword}{template} <\textcolor{keywordtype}{char}... Cs>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00230}\mbox{\hyperlink{namespacekblib_1_1literals_a89800ca5a1a2c396a3905227cb2919ad}{00230}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \textcolor{keyword}{operator}\textcolor{stringliteral}{"{}"{}}\_c() \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00231}00231 \textcolor{keyword}{constexpr} \textcolor{keywordtype}{char} arr[] = \{Cs...\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00232}00232 \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1constant}{constant}}(arr)>\{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00233}00233 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00234}00234 \textcolor{keyword}{template} <\textcolor{keywordtype}{char}... Cs>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00235}\mbox{\hyperlink{namespacekblib_1_1literals_adfec289c33286ad36edb6fe60932d1bb}{00235}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \textcolor{keyword}{operator}\textcolor{stringliteral}{"{}"{}}\_cu() \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00236}00236 \textcolor{keyword}{constexpr} \textcolor{keywordtype}{char} arr[] = \{Cs...\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00237}00237 \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1constant}{constant}}(arr)>\{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00238}00238 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00239}00239 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00240}00240 \} \textcolor{comment}{// namespace literals}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00241}00241 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00242}00242 \textcolor{keyword}{template} <\textcolor{keyword}{typename} E,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00243}00243 \textcolor{keyword}{typename} = \textcolor{keyword}{typename} std::enable\_if::value>::type>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00244}\mbox{\hyperlink{namespacekblib_adceb810a61acaa78f10a700d1618aad7}{00244}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adceb810a61acaa78f10a700d1618aad7}{etoi}}(E \mbox{\hyperlink{namespacekblib_a536badb265b62a85034f48e0eac76a1b}{e}}) -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00245}00245 \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}std::underlying\_type\_t\textcolor{keyword}{>}(\mbox{\hyperlink{namespacekblib_a536badb265b62a85034f48e0eac76a1b}{e}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00246}00246 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00247}00247 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00248}00248 \textcolor{keyword}{template} <\textcolor{keywordtype}{int} maxBufLen = 4096, \textcolor{keyword}{typename} clock, \textcolor{keyword}{typename} duration>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00249}\mbox{\hyperlink{namespacekblib_a20e83a66411498f8637634a99ceef8f7}{00249}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a20e83a66411498f8637634a99ceef8f7}{time\_to\_str}}(std::chrono::time\_point\& tp,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00250}00250 \textcolor{keyword}{const} std::string\& fmt = \textcolor{stringliteral}{"{}\%F \%T"{}})} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00251}00251 -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00252}00252 std::time\_t time = clock::to\_time\_t(tp);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00253}00253 std::tm* tmb = std::localtime(\&time);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00254}00254 std::string ret\{maxBufLen, \textcolor{charliteral}{'\(\backslash\)0'}\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00255}00255 std::strftime(\&ret.front(), maxBufLen, fmt.c\_str(), tmb);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00256}00256 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00257}00257 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00258}00258 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00263}\mbox{\hyperlink{namespacekblib_1_1detail__units}{00263}} \textcolor{keyword}{namespace }\mbox{\hyperlink{namespacedetail__units}{detail\_units}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00264}00264 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00265}\mbox{\hyperlink{namespacekblib_1_1detail__units_a5b67207eadfabcfe454fe689b5df8158}{00265}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::nanoseconds) \textcolor{keyword}{noexcept}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00266}00266 -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00267}00267 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}ns"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00268}00268 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00269}\mbox{\hyperlink{namespacekblib_1_1detail__units_a2b5f222449991440b95bc8db6ce2ce2b}{00269}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::microseconds) \textcolor{keyword}{noexcept}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00270}00270 -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00271}00271 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}us"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00272}00272 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00273}\mbox{\hyperlink{namespacekblib_1_1detail__units_a9bea3cd0da262e0ab399d1e2c6b68e45}{00273}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::milliseconds) \textcolor{keyword}{noexcept}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00274}00274 -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00275}00275 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}ms"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00276}00276 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00277}00277 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00278}\mbox{\hyperlink{namespacekblib_1_1detail__units_afe883576fe9e5b051cb48f90eaefe574}{00278}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::seconds) \textcolor{keyword}{noexcept}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00279}00279 -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00280}00280 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}s"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00281}00281 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00282}\mbox{\hyperlink{namespacekblib_1_1detail__units_ad7e8b1898efc63c595067f7d27448222}{00282}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::minutes) \textcolor{keyword}{noexcept}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00283}00283 -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00284}00284 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}min"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00285}00285 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00286}\mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{00286}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::hours) \textcolor{keyword}{noexcept} -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00287}00287 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}hr"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00288}00288 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00289}00289 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00290}00290 \textcolor{preprocessor}{\# if KBLIB\_USE\_CXX20}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00291}00291 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00292}00292 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::days) \textcolor{keyword}{noexcept} -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00293}00293 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}ns"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00294}00294 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00295}00295 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::weeks) \textcolor{keyword}{noexcept} -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00296}00296 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}ns"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00297}00297 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00298}00298 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::months) \textcolor{keyword}{noexcept}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00299}00299 -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00300}00300 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}ns"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00301}00301 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00302}00302 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ab6de7bcb990f9c55a7abc4b176206632}{unit\_of}}(std::chrono::years) \textcolor{keyword}{noexcept} -\/> \textcolor{keyword}{auto} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00303}00303 \textcolor{keywordflow}{return} \textcolor{stringliteral}{"{}ns"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00304}00304 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00305}00305 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00306}00306 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00307}00307 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00308}\mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{00308}} \textcolor{keyword}{struct }\mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00309}\mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix_acdbee2572120a346077c49af71957c4f}{00309}} \textcolor{keywordtype}{char} name[16];} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00310}\mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix_a8bca96eb352363ad504474fbefbee0c7}{00310}} \textcolor{keywordtype}{char} abbr[4];} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00311}00311 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00312}00312 \textcolor{comment}{// if std::intmax\_t can represent the denominator}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00313}00313 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 18)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00314}00314 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::yocto) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}yocto"{}}, \textcolor{stringliteral}{"{}y"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00315}00315 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00316}00316 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 8)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00317}00317 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::zepto) -\/> prefix \{ \textcolor{keywordflow}{return} prefix\{\textcolor{stringliteral}{"{}zepto"{}}, \textcolor{stringliteral}{"{}z"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00318}00318 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00319}\mbox{\hyperlink{namespacekblib_1_1detail__units_ab0d67fc3efbbc49a96fa0cc5547b3c56}{00319}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::atto) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}atto"{}}, \textcolor{stringliteral}{"{}a"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00320}\mbox{\hyperlink{namespacekblib_1_1detail__units_ab9dd9c0d4b9a08db85eae55aaa2ea3b4}{00320}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::femto) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}femto"{}}, \textcolor{stringliteral}{"{}f"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00321}\mbox{\hyperlink{namespacekblib_1_1detail__units_a59ca4a802ab37b0eb4eb501f797dad0d}{00321}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::pico) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}pico"{}}, \textcolor{stringliteral}{"{}p"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00322}\mbox{\hyperlink{namespacekblib_1_1detail__units_a66cd14898e5e4bba5f6350c352bb6518}{00322}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::nano) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}nano"{}}, \textcolor{stringliteral}{"{}n"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00323}\mbox{\hyperlink{namespacekblib_1_1detail__units_a634bad845db5d3fb2af73ef1013c8198}{00323}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::micro) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}micro"{}}, \textcolor{stringliteral}{"{}u"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00324}\mbox{\hyperlink{namespacekblib_1_1detail__units_a35bb0ed8bd2fdbc3ac659701222a88ad}{00324}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::milli) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}milli"{}}, \textcolor{stringliteral}{"{}m"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00325}\mbox{\hyperlink{namespacekblib_1_1detail__units_a93988d999b53eec149fe9021b82c2721}{00325}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::centi) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}centi"{}}, \textcolor{stringliteral}{"{}c"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00326}\mbox{\hyperlink{namespacekblib_1_1detail__units_a5ee756a4cd07f55e5b91f50d74b71b93}{00326}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::deci) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}deci"{}}, \textcolor{stringliteral}{"{}d"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00327}00327 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00328}\mbox{\hyperlink{namespacekblib_1_1detail__units_a2f1d5a072702a1d60b53317a80aaa2a7}{00328}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::ratio<1, 1>) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}"{}}, \textcolor{stringliteral}{"{}"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00329}00329 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00330}\mbox{\hyperlink{namespacekblib_1_1detail__units_ac7b5da6b329879e79c7c1d1b96e16724}{00330}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::deca) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}deca"{}}, \textcolor{stringliteral}{"{}da"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00331}\mbox{\hyperlink{namespacekblib_1_1detail__units_a2bb8597ac9e0d076e29c262910244ea4}{00331}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::hecto) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}hecto"{}}, \textcolor{stringliteral}{"{}h"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00332}\mbox{\hyperlink{namespacekblib_1_1detail__units_a0436c9bcf1829bb4d6aff3ed42bd9013}{00332}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::kilo) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}kilo"{}}, \textcolor{stringliteral}{"{}k"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00333}\mbox{\hyperlink{namespacekblib_1_1detail__units_a27459a8289db9778fae97f0150323699}{00333}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::mega) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}mega"{}}, \textcolor{stringliteral}{"{}M"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00334}\mbox{\hyperlink{namespacekblib_1_1detail__units_aa32beff86a36c3053d61694fb8937ab0}{00334}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::giga) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}giga"{}}, \textcolor{stringliteral}{"{}G"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00335}\mbox{\hyperlink{namespacekblib_1_1detail__units_a630dc236e8f8dfdf7765903661bf30d3}{00335}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::tera) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}tera"{}}, \textcolor{stringliteral}{"{}T"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00336}\mbox{\hyperlink{namespacekblib_1_1detail__units_a70fee5965a755b4cfd3ee7e39dcba66a}{00336}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::peta) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}peta"{}}, \textcolor{stringliteral}{"{}P"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00337}\mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{00337}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::exa) -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}} \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1detail__units_1_1prefix}{prefix}}\{\textcolor{stringliteral}{"{}exa"{}}, \textcolor{stringliteral}{"{}E"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00338}00338 \textcolor{comment}{// if std::intmax\_t can represent the numerator}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00339}00339 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 8)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00340}00340 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::zetta) -\/> prefix \{ \textcolor{keywordflow}{return} prefix\{\textcolor{stringliteral}{"{}zetta"{}}, \textcolor{stringliteral}{"{}Z"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00341}00341 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00342}00342 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 18)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00343}00343 \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{name\_of}}(std::yotta) -\/> prefix \{ \textcolor{keywordflow}{return} prefix\{\textcolor{stringliteral}{"{}yotta"{}}, \textcolor{stringliteral}{"{}Y"{}}\}; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00344}00344 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00345}00345 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00346}\mbox{\hyperlink{namespacekblib_1_1detail__units_af834e3efc689ff32dfeb6d2b82f5251e}{00346}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ae7333c9b309f4ce4315e40cff949c7f1}{largest\_power\_1000}}(std::intmax\_t in) -\/> \textcolor{keywordtype}{int} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00347}00347 \textcolor{keywordflow}{if} (in \% 1000 == 0) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00348}00348 \textcolor{keywordflow}{return} 1 + \mbox{\hyperlink{namespacekblib_1_1detail__units_ae7333c9b309f4ce4315e40cff949c7f1}{largest\_power\_1000}}(in / 1000);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00349}00349 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00350}00350 \textcolor{keywordflow}{return} 0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00351}00351 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00352}00352 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00353}00353 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00354}\mbox{\hyperlink{namespacekblib_1_1detail__units_a51f34ee6971dba5c08e0ad0799acfa20}{00354}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a51f34ee6971dba5c08e0ad0799acfa20}{largest\_power\_1000\_p}}(\textcolor{keywordtype}{double} in) -\/> \textcolor{keywordtype}{int} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00355}00355 \textcolor{keywordflow}{if} (in / 1000 >= 1) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00356}00356 \textcolor{keywordflow}{return} 1 + \mbox{\hyperlink{namespacekblib_1_1detail__units_a51f34ee6971dba5c08e0ad0799acfa20}{largest\_power\_1000\_p}}(in / 1000.);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00357}00357 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00358}00358 \textcolor{keywordflow}{return} 0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00359}00359 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00360}00360 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00361}\mbox{\hyperlink{namespacekblib_1_1detail__units_ae7333c9b309f4ce4315e40cff949c7f1}{00361}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_ae7333c9b309f4ce4315e40cff949c7f1}{largest\_power\_1000}}(\textcolor{keywordtype}{double} in) -\/> \textcolor{keywordtype}{int} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00362}00362 \textcolor{keywordflow}{if} (in < 1) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00363}00363 \textcolor{keywordflow}{return} -\/\mbox{\hyperlink{namespacekblib_1_1detail__units_a51f34ee6971dba5c08e0ad0799acfa20}{largest\_power\_1000\_p}}(1 / in);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00364}00364 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00365}00365 \textcolor{keywordflow}{if} (in / 1000 >= 1) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00366}00366 \textcolor{keywordflow}{return} 1 + \mbox{\hyperlink{namespacekblib_1_1detail__units_a51f34ee6971dba5c08e0ad0799acfa20}{largest\_power\_1000\_p}}(in / 1000.);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00367}00367 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00368}00368 \textcolor{keywordflow}{return} 0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00369}00369 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00370}00370 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00371}00371 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00372}\mbox{\hyperlink{namespacekblib_1_1detail__units_a40ba1dfe837d8c84da5e6bab51698b98}{00372}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_a40ba1dfe837d8c84da5e6bab51698b98}{pow1000}}(\textcolor{keywordtype}{int} p) -\/> \textcolor{keywordtype}{double} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00373}00373 \textcolor{keyword}{auto} r = 1.0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00374}00374 \textcolor{keywordflow}{if} (p >= 0) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00375}00375 \textcolor{keywordflow}{while} (p-\/-\/) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00376}00376 r *= 1000.;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00377}00377 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00378}00378 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00379}00379 \textcolor{keywordflow}{while} (p++) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00380}00380 r /= 1000.;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00381}00381 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00382}00382 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00383}00383 \textcolor{keywordflow}{return} r;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00384}00384 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00385}00385 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00386}00386 \textcolor{keyword}{template} <\textcolor{keyword}{typename} R>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00387}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{00387}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}} : std::false\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00388}00388 \textcolor{comment}{// if std::intmax\_t can represent the denominator}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00389}00389 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 18)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00390}00390 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00391}00391 \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::yocto> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00392}00392 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00393}00393 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 8)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00394}00394 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00395}00395 \textcolor{keyword}{struct }is\_si\_ratio<\mbox{\hyperlink{namespacestd}{std}}::zepto> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00396}00396 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00397}00397 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00398}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1atto_01_4}{00398}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::atto> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00399}00399 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00400}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1femto_01_4}{00400}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::femto> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00401}00401 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00402}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1pico_01_4}{00402}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::pico> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00403}00403 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00404}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1nano_01_4}{00404}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::nano> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00405}00405 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00406}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1micro_01_4}{00406}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::micro> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00407}00407 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00408}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1milli_01_4}{00408}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::milli> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00409}00409 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00410}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1centi_01_4}{00410}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::centi> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00411}00411 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00412}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1deci_01_4}{00412}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::deci> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00413}00413 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00414}00414 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00415}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1ratio_3_011_01_4_01_4}{00415}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::ratio<1>> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00416}00416 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00417}00417 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00418}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1deca_01_4}{00418}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::deca> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00419}00419 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00420}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1hecto_01_4}{00420}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::hecto> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00421}00421 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00422}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1kilo_01_4}{00422}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::kilo> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00423}00423 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00424}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1mega_01_4}{00424}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::mega> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00425}00425 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00426}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1giga_01_4}{00426}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::giga> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00427}00427 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00428}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1tera_01_4}{00428}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::tera> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00429}00429 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00430}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1peta_01_4}{00430}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::peta> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00431}00431 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00432}\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio_3_01std_1_1exa_01_4}{00432}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::exa> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00433}00433 \textcolor{comment}{// if std::intmax\_t can represent the numerator}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00434}00434 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 8)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00435}00435 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00436}00436 \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1is__si__ratio}{is\_si\_ratio}}<\mbox{\hyperlink{namespacestd}{std}}::zetta> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00437}00437 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00438}00438 \textcolor{preprocessor}{\# if (-\/1U >> 63) > (1U << 18)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00439}00439 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00440}00440 \textcolor{keyword}{struct }is\_si\_ratio<\mbox{\hyperlink{namespacestd}{std}}::yotta> : std::true\_type \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00441}00441 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00442}00442 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00443}00443 \textcolor{keyword}{template} <\textcolor{keyword}{typename} M>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00444}\mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion}{00444}} \textcolor{keyword}{struct }\mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion}{unit\_conversion}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00445}\mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion_a763c5e8e4741b2e3a85c814ca394145e}{00445}} \textcolor{keyword}{const} \textcolor{keywordtype}{char}* \mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion_a763c5e8e4741b2e3a85c814ca394145e}{scale\_prefix}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00446}\mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion_ad924212b590e3c35937acfd72c424b65}{00446}} \textcolor{keywordtype}{char} abbr[6];} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00447}\mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion_a7082d3b4e04385fd705d51828bb90d1c}{00447}} M \mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion_a7082d3b4e04385fd705d51828bb90d1c}{multiplier}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00448}00448 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00449}00449 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00450}00450 \textcolor{keyword}{template} } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00451}\mbox{\hyperlink{namespacekblib_1_1detail__units_aa299c305c7e856fce7b3ed9ad0f22b0d}{00451}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1detail__units_aa299c305c7e856fce7b3ed9ad0f22b0d}{ratio\_to\_SI}}() noexcept -\/> \mbox{\hyperlink{structkblib_1_1detail__units_1_1unit__conversion}{unit\_conversion}}<\mbox{\hyperlink{namespacestd}{std}}::intmax\_t> \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00452}00452 \textcolor{keywordflow}{return} \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00453}00453 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00454}00454 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00455}00455 \textcolor{keyword}{template} } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00456}\mbox{\hyperlink{structkblib_1_1detail__units_1_1nearest__ratio}{00456}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__units_1_1nearest__ratio}{nearest\_ratio}} \{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00457}00457 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00458}00458 \textcolor{keyword}{template} } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00459}\mbox{\hyperlink{namespacekblib_1_1detail__units_af25fd7cadaf3e2eb0eb78e555ea99575}{00459}} \textcolor{keyword}{using }\mbox{\hyperlink{namespacekblib_1_1detail__units_af25fd7cadaf3e2eb0eb78e555ea99575}{nearest\_ratio\_t}} = \textcolor{keyword}{typename} \mbox{\hyperlink{structkblib_1_1detail__units_1_1nearest__ratio}{nearest\_ratio::type}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00460}00460 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00461}00461 \} \textcolor{comment}{// namespace detail\_units}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00462}00462 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00463}00463 \textcolor{keyword}{template} <} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00464}00464 \textcolor{keyword}{typename} Rep, \textcolor{keyword}{typename} Ratio,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00465}00465 \mbox{\hyperlink{namespacekblib_a366272ad8baad19be4ccf8128afb04a3}{enable\_if\_t::value}}>* = 0>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00466}\mbox{\hyperlink{namespacekblib_af9a5bf09da3c4820ffd701def6a6f6da}{00466}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adab181ff9f8850e2e5b6790a78d62cfc}{duration\_to\_str}}(std::chrono::duration\& d)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00467}00467 -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00468}00468 \textcolor{keyword}{using }ratio = \textcolor{keyword}{typename} Ratio::type;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00469}00469 \textcolor{keyword}{auto} cv = detail\_units::ratio\_to\_SI();} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00470}00470 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a56615de712caf1b43a541f5387a4b847}{concat}}(d.count() * cv.multiplier, \textcolor{charliteral}{' '}, cv.abbr, \textcolor{charliteral}{'s'});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00471}00471 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00472}00472 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00473}00473 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Rep, \textcolor{keyword}{typename} Ratio,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00474}00474 enable\_if\_t::value>* = 0>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00475}00475 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adab181ff9f8850e2e5b6790a78d62cfc}{duration\_to\_str}}(std::chrono::duration\& d)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00476}00476 -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00477}00477 \textcolor{keyword}{using }ratio = \textcolor{keyword}{typename} Ratio::type;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00478}00478 \textcolor{keyword}{using }n\_r = detail\_units::nearest\_ratio\_t;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00479}00479 \textcolor{keyword}{auto} u = \mbox{\hyperlink{namespacekblib_1_1detail__units_a5259a33f11d7892b012c80cb1a841f90}{detail\_units::name\_of}}(n\_r\{\});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00480}00480 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00481}00481 \textcolor{comment}{// require an implicit cast}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00482}00482 std::chrono::duration n\_d = d;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00483}00483 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a56615de712caf1b43a541f5387a4b847}{concat}}(n\_d.count(), \textcolor{charliteral}{' '}, u.abbr, \textcolor{charliteral}{'s'});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00484}00484 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00485}00485 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00486}00486 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Rep>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00487}\mbox{\hyperlink{namespacekblib_a9b4feeb3f624bef85e84024c3ffddb64}{00487}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adab181ff9f8850e2e5b6790a78d62cfc}{duration\_to\_str}}(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00488}00488 std::chrono::duration> d) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00489}00489 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a56615de712caf1b43a541f5387a4b847}{concat}}(d.count(), \textcolor{stringliteral}{"{} min"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00490}00490 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00491}00491 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Rep>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00492}\mbox{\hyperlink{namespacekblib_adab181ff9f8850e2e5b6790a78d62cfc}{00492}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adab181ff9f8850e2e5b6790a78d62cfc}{duration\_to\_str}}(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00493}00493 std::chrono::duration> d) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00494}00494 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a56615de712caf1b43a541f5387a4b847}{concat}}(d.count(), \textcolor{stringliteral}{"{} hr"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00495}00495 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00496}00496 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00497}00497 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00498}\mbox{\hyperlink{namespacekblib_a8c75f5ab3c250a21cb71377f34304575}{00498}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a8c75f5ab3c250a21cb71377f34304575}{url\_encode}}(\textcolor{keyword}{const} \textcolor{keywordtype}{string}\& value) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00499}00499 std::ostringstream escaped;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00500}00500 escaped.fill(\textcolor{charliteral}{'0'});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00501}00501 escaped << std::hex;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00502}00502 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00503}00503 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{char} c : value) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00504}00504 \textcolor{comment}{// Keep alphanumeric and other accepted characters intact}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00505}00505 \textcolor{keywordflow}{if} (std::isalnum(c) or c == \textcolor{charliteral}{'-\/'} or c == \textcolor{charliteral}{'\_'} or c == \textcolor{charliteral}{'.'} or c == \textcolor{charliteral}{'\string~'}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00506}00506 escaped << c;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00507}00507 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00508}00508 \textcolor{comment}{// Any other characters are percent-\/encoded}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00509}00509 escaped << std::uppercase;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00510}00510 escaped << \textcolor{charliteral}{'\%'} << std::setw(2) << int(\mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(c));} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00511}00511 escaped << std::nouppercase;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00512}00512 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00513}00513 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00514}00514 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00515}00515 \textcolor{keywordflow}{return} escaped.str();} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00516}00516 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00517}00517 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00518}00518 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00519}\mbox{\hyperlink{namespacekblib_a39eea8a137cf73e71ddcba1a074b5ca1}{00519}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a39eea8a137cf73e71ddcba1a074b5ca1}{html\_encode}}(\textcolor{keyword}{const} \textcolor{keywordtype}{string}\& data) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00520}00520 std::string \mbox{\hyperlink{structbuffer}{buffer}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00521}00521 \textcolor{comment}{// Arbitrary estimate for amount of growth caused by the escaping is 12.5\%.}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00522}00522 \mbox{\hyperlink{structbuffer}{buffer}}.reserve(data.size() + data.size() / 8);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00523}00523 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{char} c : data) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00524}00524 \textcolor{keywordflow}{switch} (c) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00525}00525 \textcolor{keywordflow}{case} \textcolor{charliteral}{'\&'}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00526}00526 \mbox{\hyperlink{structbuffer}{buffer}}.append(\textcolor{stringliteral}{"{}\&"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00527}00527 \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00528}00528 \textcolor{keywordflow}{case} \textcolor{charliteral}{'\(\backslash\)"{}'}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00529}00529 \mbox{\hyperlink{structbuffer}{buffer}}.append(\textcolor{stringliteral}{"{}\""{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00530}00530 \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00531}00531 \textcolor{keywordflow}{case} \textcolor{charliteral}{'\(\backslash\)''}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00532}00532 \mbox{\hyperlink{structbuffer}{buffer}}.append(\textcolor{stringliteral}{"{}\'"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00533}00533 \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00534}00534 \textcolor{keywordflow}{case} \textcolor{charliteral}{'<'}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00535}00535 \mbox{\hyperlink{structbuffer}{buffer}}.append(\textcolor{stringliteral}{"{}\<"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00536}00536 \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00537}00537 \textcolor{keywordflow}{case} \textcolor{charliteral}{'>'}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00538}00538 \mbox{\hyperlink{structbuffer}{buffer}}.append(\textcolor{stringliteral}{"{}\>"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00539}00539 \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00540}00540 \textcolor{keywordflow}{default}:} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00541}00541 \mbox{\hyperlink{structbuffer}{buffer}}.push\_back(c);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00542}00542 \textcolor{keywordflow}{break};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00543}00543 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00544}00544 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00545}00545 \textcolor{keywordflow}{return} \mbox{\hyperlink{structbuffer}{buffer}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00546}00546 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00547}00547 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00548}\mbox{\hyperlink{namespacekblib_ac0e93ddcc6d5c76947773411b4b1c324}{00548}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adc6dd5988f5ae20b8c0538bd50bd3657}{escapify}}(\textcolor{keywordtype}{char} c) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00549}00549 \textcolor{keyword}{auto} value = \mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(c);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00550}00550 \textcolor{keywordflow}{if} (value < \textcolor{charliteral}{' '} or value == \textcolor{stringliteral}{'\(\backslash\)x7F'} or value \& \mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(\textcolor{stringliteral}{'\(\backslash\)x80'})) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00551}00551 \textcolor{keyword}{constexpr} std::array digits\{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00552}00552 \mbox{\hyperlink{namespacekblib_a9bfc51ee4b1118cf5effed3d4ae9dfed}{remove\_null\_terminator}}(\textcolor{stringliteral}{"{}0123456789ABCDEF"{}})\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00553}00553 std::string rc(\textcolor{stringliteral}{"{}\(\backslash\)\(\backslash\)x "{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00554}00554 rc[2] = digits[value >> 4u];} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00555}00555 rc[3] = digits[value \& 15u];} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00556}00556 \textcolor{keywordflow}{return} rc;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00557}00557 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00558}00558 \textcolor{keywordflow}{return} std::string(1, \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{char}\textcolor{keyword}{>}(value));} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00559}00559 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00560}00560 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00561}00561 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00562}00562 \textcolor{comment}{// Accepts any sequence of char, returns printable string}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00563}00563 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00564}\mbox{\hyperlink{namespacekblib_adc6dd5988f5ae20b8c0538bd50bd3657}{00564}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adc6dd5988f5ae20b8c0538bd50bd3657}{escapify}}(\textcolor{keyword}{const} \textcolor{keywordtype}{string}\& value) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00565}00565 std::ostringstream ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00566}00566 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{char} c : value) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00567}00567 \textcolor{keywordflow}{if} (c < ' ' or c >= \textcolor{stringliteral}{'\(\backslash\)x7F'}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00568}00568 ret << \mbox{\hyperlink{namespacekblib_adc6dd5988f5ae20b8c0538bd50bd3657}{escapify}}(c);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00569}00569 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00570}00570 ret << c;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00571}00571 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00572}00572 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00573}00573 \textcolor{keywordflow}{return} ret.str();} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00574}00574 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00575}00575 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00576}00576 \textcolor{comment}{// Given a string and a pointer into it, calculate the effective index of that}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00577}00577 \textcolor{comment}{// pointer into a string such as created by kblib::escapify(value)}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00578}00578 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00579}\mbox{\hyperlink{namespacekblib_afb501736f34154b5b1864cdace039fba}{00579}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adf7bda5746d41d56ad8030ec34042c49}{calculate\_translated\_index}}(\textcolor{keywordtype}{string}\&\& value, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* p)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00580}00580 -\/> std::ptrdiff\_t \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00581}00581 std::ptrdiff\_t counter = 0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00582}00582 \textcolor{keywordflow}{for} (\textcolor{keyword}{auto}\&\& c : value) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00583}00583 \textcolor{keywordflow}{if} (\&c == p) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00584}00584 \textcolor{keywordflow}{return} counter;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00585}00585 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00586}00586 counter += (std::isprint(c)) ? 1 : 4;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00587}00587 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00588}00588 \textcolor{keywordflow}{return} counter;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00589}00589 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00590}00590 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00591}\mbox{\hyperlink{namespacekblib_adf7bda5746d41d56ad8030ec34042c49}{00591}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_adf7bda5746d41d56ad8030ec34042c49}{calculate\_translated\_index}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char}* value,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00592}00592 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* p)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00593}00593 -\/> std::ptrdiff\_t \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00594}00594 \textcolor{keywordflow}{if} (not value) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00595}00595 \textcolor{keywordflow}{throw} std::invalid\_argument(} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00596}00596 \textcolor{stringliteral}{"{}calculate\_translated\_index can't take a nullptr"{}});} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00597}00597 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00598}00598 std::ptrdiff\_t counter = 0;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00599}00599 \textcolor{keywordflow}{while} (*value) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00600}00600 \textcolor{keywordflow}{if} (value == p) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00601}00601 \textcolor{keywordflow}{return} counter;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00602}00602 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00603}00603 counter += (std::isprint(*value)) ? 1 : 4;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00604}00604 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00605}00605 \textcolor{keywordflow}{return} counter;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00606}00606 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00607}00607 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00608}00608 \textcolor{keyword}{template} <\textcolor{keyword}{typename} \textcolor{keywordtype}{string}>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00609}\mbox{\hyperlink{namespacekblib_a63baa5a83839bafa605866cd558a66aa}{00609}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a63baa5a83839bafa605866cd558a66aa}{quoted}}(\textcolor{keywordtype}{string}\&\& in) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00610}00610 std::ostringstream ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00611}00611 ret << \textcolor{charliteral}{'"{}'};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00612}00612 \textcolor{keywordflow}{for} (\textcolor{keywordtype}{char} c : in) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00613}00613 \textcolor{keywordflow}{if} (c < ' ' or c >= \textcolor{stringliteral}{'\(\backslash\)x7F'}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00614}00614 ret << \mbox{\hyperlink{namespacekblib_adc6dd5988f5ae20b8c0538bd50bd3657}{escapify}}(c);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00615}00615 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (c == \textcolor{charliteral}{'"{}'}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00616}00616 ret << \textcolor{stringliteral}{"{}\(\backslash\)\(\backslash\)\(\backslash\)"{}"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00617}00617 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (c == \textcolor{charliteral}{'\(\backslash\)\(\backslash\)'}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00618}00618 ret << \textcolor{stringliteral}{"{}\(\backslash\)\(\backslash\)\(\backslash\)\(\backslash\)"{}};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00619}00619 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00620}00620 ret << c;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00621}00621 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00622}00622 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00623}00623 ret << \textcolor{charliteral}{'"{}'};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00624}00624 \textcolor{keywordflow}{return} ret.str();} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00625}00625 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00626}00626 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00627}00627 \textcolor{comment}{// This only uses RTTI because C++ has no other means to get "{}int"{} from a}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00628}00628 \textcolor{comment}{// template parameter.}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00629}00629 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00630}\mbox{\hyperlink{namespacekblib_adcf60327cd3273416aee1f4e21c545a2}{00630}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(\textcolor{keyword}{const} std::string\& val,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00631}00631 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type = \textcolor{keyword}{typeid}(T).name()) -\/> T \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00632}00632 std::stringstream ss(val);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00633}00633 T ret\{\};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00634}00634 \textcolor{keywordflow}{if} (not (ss >> std::boolalpha >> ret).fail()) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00635}00635 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00636}00636 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00637}00637 \textcolor{keywordflow}{throw} std::runtime\_error(\mbox{\hyperlink{namespacekblib_a63baa5a83839bafa605866cd558a66aa}{kblib::quoted}}(val) + \textcolor{stringliteral}{"{} is not a "{}} + type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00638}00638 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00639}00639 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00640}00640 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00641}\mbox{\hyperlink{namespacekblib_a57f578123119b93875bef04cfe49f65e}{00641}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(\textcolor{keyword}{const} std::string\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00642}00642 -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00643}00643 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00644}00644 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00645}00645 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00646}\mbox{\hyperlink{namespacekblib_a7c6f875ac9139f22c86dd6dd4d9065b1}{00646}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(\textcolor{keyword}{const} std::string\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00647}00647 -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00648}00648 \textcolor{keywordflow}{if} (val == \textcolor{stringliteral}{"{}1"{}} or val == \textcolor{stringliteral}{"{}true"{}}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00649}00649 \textcolor{keywordflow}{return} \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00650}00650 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (val == \textcolor{stringliteral}{"{}0"{}} or val == \textcolor{stringliteral}{"{}false"{}}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00651}00651 \textcolor{keywordflow}{return} \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00652}00652 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00653}00653 \textcolor{keywordflow}{throw} std::runtime\_error(\mbox{\hyperlink{namespacekblib_a63baa5a83839bafa605866cd558a66aa}{kblib::quoted}}(val) + \textcolor{stringliteral}{"{} is not a "{}} + type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00654}00654 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00655}00655 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00656}00656 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00657}00657 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00658}\mbox{\hyperlink{namespacekblib_a8a395da2f21ab1bf9f7753dafa31024b}{00658}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\&\& val,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00659}00659 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type = \textcolor{keyword}{typeid}(T).name()) -\/> T \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00660}00660 std::stringstream ss(val);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00661}00661 T ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00662}00662 \textcolor{keywordflow}{if} (not (ss >> std::boolalpha >> ret).fail()) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00663}00663 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00664}00664 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00665}00665 \textcolor{keywordflow}{throw} std::runtime\_error(\mbox{\hyperlink{namespacekblib_a63baa5a83839bafa605866cd558a66aa}{kblib::quoted}}(val) + \textcolor{stringliteral}{"{} is not a "{}} + type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00666}00666 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00667}00667 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00668}00668 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00669}\mbox{\hyperlink{namespacekblib_a853a2017ce132aff49da11dc89c0d4f8}{00669}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\&\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00670}00670 -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00671}00671 \textcolor{keywordflow}{return} std::move(val);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00672}00672 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00673}00673 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00674}\mbox{\hyperlink{namespacekblib_aa4044dd6c31f3ad46403c7c160f117f7}{00674}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\&\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00675}00675 -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00676}00676 \textcolor{keywordflow}{if} (val == \textcolor{stringliteral}{"{}1"{}} or val == \textcolor{stringliteral}{"{}true"{}}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00677}00677 \textcolor{keywordflow}{return} \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00678}00678 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (val == \textcolor{stringliteral}{"{}0"{}} or val == \textcolor{stringliteral}{"{}false"{}}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00679}00679 \textcolor{keywordflow}{return} \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00680}00680 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00681}00681 \textcolor{keywordflow}{throw} std::runtime\_error(\mbox{\hyperlink{namespacekblib_a63baa5a83839bafa605866cd558a66aa}{kblib::quoted}}(val) + \textcolor{stringliteral}{"{} is not a "{}} + type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00682}00682 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00683}00683 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00684}00684 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00685}00685 \textcolor{preprocessor}{\# if KBLIB\_USE\_STRING\_VIEW}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00686}00686 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00687}00687 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00688}\mbox{\hyperlink{namespacekblib_a0edc4804a0cef00e0ee38e0545a5c185}{00688}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(\textcolor{keyword}{const} std::string\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00689}00689 -\/> std::string\_view \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00690}00690 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00691}00691 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00692}00692 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00693}00693 \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\&\&, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*) -\/> std::string\_view = \textcolor{keyword}{delete};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00694}00694 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00695}00695 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00696}\mbox{\hyperlink{namespacekblib_aa7bf83ca8ddfe3ca539cb91272916b49}{00696}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\_view val,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00697}00697 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type = \textcolor{keyword}{typeid}(T).name()) -\/> T \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00698}00698 std::istrstream ss(val.data(), \mbox{\hyperlink{namespacekblib_a1909a64960663825ccc4eb98e4637df2}{kblib::to\_signed}}(val.size()));} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00699}00699 T ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00700}00700 \textcolor{keywordflow}{if} (not (ss >> std::boolalpha >> ret).fail()) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00701}00701 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00702}00702 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00703}00703 \textcolor{keywordflow}{throw} std::runtime\_error(\mbox{\hyperlink{namespacekblib_a63baa5a83839bafa605866cd558a66aa}{kblib::quoted}}(val) + \textcolor{stringliteral}{"{} is not a "{}} + type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00704}00704 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00705}00705 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00706}00706 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00707}\mbox{\hyperlink{namespacekblib_a0d43c9471efd41988e7fe3803ebe9920}{00707}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\_view val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00708}00708 -\/> std::string\_view \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00709}00709 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00710}00710 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00711}00711 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00712}\mbox{\hyperlink{namespacekblib_accb73432c51f1abcb19600cbc74c76b3}{00712}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\_view val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00713}00713 -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00714}00714 \textcolor{keywordflow}{return} std::string(val);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00715}00715 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00716}00716 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00717}\mbox{\hyperlink{namespacekblib_af325be078a70629608c96f77cde6f957}{00717}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(std::string\_view val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00718}00718 -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00719}00719 \textcolor{keywordflow}{if} (val == \textcolor{stringliteral}{"{}1"{}} or val == \textcolor{stringliteral}{"{}true"{}}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00720}00720 \textcolor{keywordflow}{return} \textcolor{keyword}{true};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00721}00721 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (val == \textcolor{stringliteral}{"{}0"{}} or val == \textcolor{stringliteral}{"{}false"{}}) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00722}00722 \textcolor{keywordflow}{return} \textcolor{keyword}{false};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00723}00723 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00724}00724 \textcolor{keywordflow}{throw} std::runtime\_error(\textcolor{stringliteral}{"{}\(\backslash\)"{}"{}} + std::string(val) + \textcolor{stringliteral}{"{}\(\backslash\)"{} is not a "{}} + type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00725}00725 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00726}00726 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00727}00727 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00728}00728 \textcolor{keyword}{template} <\textcolor{keyword}{typename} To, std::\textcolor{keywordtype}{size\_t} N>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00729}\mbox{\hyperlink{namespacekblib_aa4f711c2235a07748d06db315f0390fd}{00729}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} (\&val)[N],} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00730}00730 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type = \textcolor{keyword}{typeid}(To).name()) -\/> To \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00731}00731 \textcolor{comment}{// N -\/ 1: remove null terminator}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00732}00732 \textcolor{keywordflow}{return} fromStr(std::string\_view(val, N -\/ 1), type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00733}00733 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00734}00734 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00735}00735 \textcolor{keyword}{template} <\textcolor{keyword}{typename} To, \textcolor{keyword}{typename} \_>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00736}\mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{00736}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_accd006c8702a96a58797a630927f1e84}{fromStr}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char}* val,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00737}00737 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type = \textcolor{keyword}{typeid}(To).name(), \_ = 0)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00738}00738 -\/> To \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00739}00739 \textcolor{keywordflow}{return} fromStr(std::string\_view(val), type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00740}00740 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00741}00741 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00742}00742 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00743}00743 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00744}00744 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00745}\mbox{\hyperlink{namespacekblib_a600e9511e6339ab63326a78ece7df363}{00745}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a68e0483e61eda02342b8104c3832e60e}{toStr}}(T val) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00746}00746 std::stringstream ss;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00747}00747 ss << val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00748}00748 \textcolor{keywordflow}{return} ss.str();} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00749}00749 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00750}\mbox{\hyperlink{namespacekblib_a68e0483e61eda02342b8104c3832e60e}{00750}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{inline} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a68e0483e61eda02342b8104c3832e60e}{toStr}}(std::string val) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00751}00751 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00752}00752 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00753}00753 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00754}00754 \textcolor{keyword}{template} <\textcolor{keyword}{typename} To, \textcolor{keyword}{typename} From>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00755}\mbox{\hyperlink{structkblib_1_1lexical__caster}{00755}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00756}\mbox{\hyperlink{structkblib_1_1lexical__caster_aa58d5a6ed574b47ea750240c5254acb0}{00756}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_aa58d5a6ed574b47ea750240c5254acb0}{cast}}(\textcolor{keyword}{const} From\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type) -\/> To \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00757}00757 std::stringstream ss;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00758}00758 ss << val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00759}00759 To ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00760}00760 \textcolor{keywordflow}{if} (not (ss >> ret).fail()) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00761}00761 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00762}00762 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00763}00763 \textcolor{keywordflow}{throw} std::runtime\_error(\textcolor{stringliteral}{"{}Cannot convert \(\backslash\)"{}"{}} + \mbox{\hyperlink{namespacekblib_a68e0483e61eda02342b8104c3832e60e}{toStr}}(val) + \textcolor{stringliteral}{"{}\(\backslash\)"{} to "{}}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00764}00764 + type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00765}00765 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00766}00766 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00767}00767 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00768}00768 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00769}00769 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Same>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00770}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_same_00_01_same_01_4}{00770}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00771}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_same_00_01_same_01_4_a3479ee659d1e823aaadf20a19e3a0a7e}{00771}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_same_00_01_same_01_4_a3479ee659d1e823aaadf20a19e3a0a7e}{cast}}(\textcolor{keyword}{const} Same\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*) -\/> Same \{ \textcolor{keywordflow}{return} val; \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00772}00772 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00773}00773 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00774}00774 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00775}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string_00_01std_1_1string_01_4}{00775}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}}<\mbox{\hyperlink{namespacestd}{std}}::string, std::string> \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00776}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string_00_01std_1_1string_01_4_a06d31a64d3e8724ccd345ee9cc836614}{00776}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string_00_01std_1_1string_01_4_a06d31a64d3e8724ccd345ee9cc836614}{cast}}(\textcolor{keyword}{const} std::string\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00777}00777 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00778}00778 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00779}00779 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00780}00780 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00781}00781 \textcolor{keyword}{template} <\textcolor{keyword}{typename} From>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00782}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string_00_01_from_01_4}{00782}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}}<\mbox{\hyperlink{namespacestd}{std}}::string, From> \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00783}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string_00_01_from_01_4_a3f9559685bef559fa5f0b66af614b637}{00783}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string_00_01_from_01_4_a3f9559685bef559fa5f0b66af614b637}{cast}}(\textcolor{keyword}{const} From\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*) -\/> std::string \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00784}00784 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a68e0483e61eda02342b8104c3832e60e}{toStr}}(val);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00785}00785 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00786}00786 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00787}00787 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00788}00788 \textcolor{keyword}{template} <\textcolor{keyword}{typename} To>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00789}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_to_00_01std_1_1string_01_4}{00789}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00790}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_to_00_01std_1_1string_01_4_afb63ed0135ce08ac84f4a0cb295357ac}{00790}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_to_00_01std_1_1string_01_4_afb63ed0135ce08ac84f4a0cb295357ac}{cast}}(\textcolor{keyword}{const} std::string\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type) -\/> To \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00791}00791 \textcolor{keywordflow}{return} fromStr(val, type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00792}00792 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00793}00793 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00794}00794 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00795}00795 \textcolor{preprocessor}{\# if KBLIB\_USE\_STRING\_VIEW}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00796}00796 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00797}00797 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00798}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01std_1_1string__view_01_4}{00798}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}}<\mbox{\hyperlink{namespacestd}{std}}::string\_view, std::string\_view> \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00799}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01std_1_1string__view_01_4_a01984cc643078570c36fb56562c086ec}{00799}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01std_1_1string__view_01_4_a01984cc643078570c36fb56562c086ec}{cast}}(\textcolor{keyword}{const} std::string\_view\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*)} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00800}00800 -\/> std::string\_view \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00801}00801 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00802}00802 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00803}00803 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00804}00804 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00805}00805 \textcolor{keyword}{template} <>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00806}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01std_1_1string_01_4}{00806}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}}<\mbox{\hyperlink{namespacestd}{std}}::string\_view, std::string> \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00807}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01std_1_1string_01_4_aca87180300d3004f1a217510a9b12ddd}{00807}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01std_1_1string_01_4_aca87180300d3004f1a217510a9b12ddd}{cast}}(\textcolor{keyword}{const} std::string\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*) -\/> std::string\_view \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00808}00808 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00809}00809 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00810}00810 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00811}00811 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00812}00812 \textcolor{keyword}{template} <\textcolor{keyword}{typename} From>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00813}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01_from_01_4}{00813}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}}<\mbox{\hyperlink{namespacestd}{std}}::string\_view, From> \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00814}00814 \textcolor{keyword}{static} std::enable\_if\_t,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00815}00815 std::string\_view>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00816}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01_from_01_4_a7ea3d7dd2e8103d4c69c5e0ca032179d}{00816}} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01_from_01_4_a7ea3d7dd2e8103d4c69c5e0ca032179d}{cast}}(\textcolor{keyword}{const} From\& val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}*) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00817}00817 \textcolor{keywordflow}{return} From(val);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00818}00818 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00819}00819 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00820}00820 \textcolor{comment}{// DCL50-\/CPP-\/EX2:}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00821}00821 \textcolor{comment}{// As stated in the normative text, C-\/style variadic functions that are}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00822}00822 \textcolor{comment}{// declared but never defined are permitted.}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00823}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01_from_01_4_a5a23e9c748e90364b76162c7c731907e}{00823}} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01std_1_1string__view_00_01_from_01_4_a5a23e9c748e90364b76162c7c731907e}{cast}}(...) -\/> std::string\_view = \textcolor{keyword}{delete};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00824}00824 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00825}00825 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00826}00826 \textcolor{keyword}{template} <\textcolor{keyword}{typename} To>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00827}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_to_00_01std_1_1string__view_01_4}{00827}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster}} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00828}\mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_to_00_01std_1_1string__view_01_4_ad9dc397ebd33f2b4111b7a0256c0d7c8}{00828}} \textcolor{keyword}{static} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1lexical__caster_3_01_to_00_01std_1_1string__view_01_4_ad9dc397ebd33f2b4111b7a0256c0d7c8}{cast}}(std::string\_view val, \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type) -\/> To \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00829}00829 \textcolor{keywordflow}{return} fromStr(val, type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00830}00830 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00831}00831 \};} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00832}00832 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00833}00833 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00834}00834 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00835}00835 \textcolor{keyword}{template} <\textcolor{keyword}{typename} To, \textcolor{keyword}{typename} From>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00836}\mbox{\hyperlink{namespacekblib_ae68ff8cae049c12ffe3f568617e8d6c3}{00836}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ae68ff8cae049c12ffe3f568617e8d6c3}{lexical\_cast}}(\textcolor{keyword}{const} From\& val,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00837}00837 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type = \textcolor{keyword}{typeid}(To).name()) -\/> To \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00838}00838 \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1lexical__caster}{lexical\_caster::cast}}(val, type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00839}00839 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00840}00840 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00841}00841 \textcolor{preprocessor}{\# if 0}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00842}00842 \textcolor{keyword}{template} <\textcolor{keyword}{typename} To, \textcolor{keyword}{typename} From>} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00843}00843 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ae68ff8cae049c12ffe3f568617e8d6c3}{lexical\_cast}}(\textcolor{keyword}{const} From\& val,} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00844}00844 \textcolor{keyword}{const} \textcolor{keywordtype}{char}* type = \textcolor{keyword}{typeid}(To).name()) -\/> To \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00845}00845 \textcolor{keyword}{using namespace }std::literals;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00846}00846 \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_same\_v, std::decay\_t>) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00847}00847 \textcolor{keywordflow}{return} val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00848}00848 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_same\_v, std::string>) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00849}00849 \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a68e0483e61eda02342b8104c3832e60e}{toStr}}(val);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00850}00850 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} \textcolor{keyword}{constexpr} (std::is\_same\_v, std::string>) \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00851}00851 \textcolor{keywordflow}{return} fromStr(val, type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00852}00852 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00853}00853 std::stringstream ss;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00854}00854 ss << val;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00855}00855 To ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00856}00856 \textcolor{keywordflow}{if} (not(ss >> ret).fail())} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00857}00857 \textcolor{keywordflow}{return} ret;} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00858}00858 \textcolor{keywordflow}{else}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00859}00859 \textcolor{keywordflow}{throw} std::runtime\_error(\textcolor{stringliteral}{"{}Cannot convert \(\backslash\)"{}"{}}s + \mbox{\hyperlink{namespacekblib_a68e0483e61eda02342b8104c3832e60e}{toStr}}(val) + \textcolor{stringliteral}{"{}\(\backslash\)"{} to "{}} +} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00860}00860 type);} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00861}00861 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00862}00862 \}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00863}00863 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00864}00864 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00865}00865 \} \textcolor{comment}{// namespace KBLIB\_NS}} \DoxyCodeLine{\Hypertarget{convert_8h_source_l00866}00866 } \DoxyCodeLine{\Hypertarget{convert_8h_source_l00867}00867 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// KBLIB\_CONVERT\_H}} \end{DoxyCode}