\hypertarget{sort_8cpp_source}{}\doxysection{sort.\+cpp}
\label{sort_8cpp_source}\index{tests/sort.cpp@{tests/sort.cpp}}
\mbox{\hyperlink{sort_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00001}00001 \textcolor{preprocessor}{\#include "{}catch.hpp"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00002}00002 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00003}00003 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{sort_8h}{kblib/sort.h}}"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00004}00004 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00005}00005 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{stats_8h}{kblib/stats.h}}"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00006}00006 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{stringops_8h}{kblib/stringops.h}}"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00007}00007 \textcolor{preprocessor}{\#include <iomanip>}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00008}00008 \textcolor{preprocessor}{\#include <iostream>}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00009}00009 \textcolor{preprocessor}{\#include <map>}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00010}00010 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00011}00011 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T, std::\textcolor{keywordtype}{size\_t} N>}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00012}\mbox{\hyperlink{sort_8cpp_a69d35b0f10a5816a8fdc86dd88099389}{00012}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{sort_8cpp_a69d35b0f10a5816a8fdc86dd88099389}{sort\_test}}(\mbox{\hyperlink{structkblib_1_1trivial__array}{kblib::trivial\_array<T, N>}} val) \textcolor{keyword}{noexcept} -\/> \textcolor{keywordtype}{bool} \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00013}00013    \mbox{\hyperlink{structkblib_1_1trivial__array}{kblib::trivial\_array<T, N>}} out\{\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00014}00014    \mbox{\hyperlink{namespacekblib_a654de993e7d26592cdc4e05443150296}{kblib::insertion\_sort\_copy}}(val.begin(), val.end(), out.begin(), out.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00015}00015    \mbox{\hyperlink{namespacekblib_a43cda388d529e7f9553850b366ef3380}{kblib::insertion\_sort}}(val.begin(), val.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00016}00016    \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00017}00017 \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00018}00018 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00019}\mbox{\hyperlink{sort_8cpp_aff80d0822871626fe96948e69c4cc5b6}{00019}} \mbox{\hyperlink{sort_8cpp_aff80d0822871626fe96948e69c4cc5b6}{TEST\_CASE}}(\textcolor{stringliteral}{"{}sort"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00020}00020    \textcolor{keyword}{constexpr} \mbox{\hyperlink{structkblib_1_1trivial__array}{kblib::trivial\_array<int, 7>}} input\{\{3, 7, 4, 3, 1, 9, 5\}\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00021}00021    \textcolor{keyword}{const} \textcolor{keyword}{auto} goal = [\&] \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00022}00022       \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ac912dd210d34963da9bd40a1a6296308}{copy}} = input;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00023}00023       \mbox{\hyperlink{namespacekblib_1_1detail__sort_a3b873e1b1c2c3a4865638d2c904c4c1d}{std::sort}}(\mbox{\hyperlink{namespacekblib_ac912dd210d34963da9bd40a1a6296308}{copy}}.begin(), \mbox{\hyperlink{namespacekblib_ac912dd210d34963da9bd40a1a6296308}{copy}}.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00024}00024       \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_ac912dd210d34963da9bd40a1a6296308}{copy}};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00025}00025    \}();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00026}00026 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00027}00027    \mbox{\hyperlink{tdecl_8h_a607cffc585fe3bfcb06b63be2948de4a}{KBLIB\_UNUSED}} \textcolor{keyword}{auto} print\_arr = [\&](\textcolor{keyword}{auto} c) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00028}00028       \textcolor{keywordflow}{for} (\textcolor{keyword}{const} \textcolor{keyword}{auto}\& v : c) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00029}00029          std::cout << v << \textcolor{stringliteral}{"{}, "{}};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00030}00030       \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00031}00031       std::cout << \textcolor{charliteral}{'\(\backslash\)n'};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00032}00032    \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00034}00034 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00035}00035    \textcolor{keyword}{static\_assert}(\mbox{\hyperlink{sort_8cpp_a69d35b0f10a5816a8fdc86dd88099389}{sort\_test}}(input), \textcolor{stringliteral}{"{}insertion\_sort should be constexpr"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00036}00036 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00037}00037 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00038}00038    SECTION(\textcolor{stringliteral}{"{}insertion\_sort"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00039}00039       \textcolor{keyword}{auto} input\_copy = input;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00040}00040       \mbox{\hyperlink{namespacekblib_a43cda388d529e7f9553850b366ef3380}{kblib::insertion\_sort}}(input\_copy.begin(), input\_copy.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00041}00041       CHECK(input\_copy == goal);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00042}00042       \textcolor{keyword}{static\_assert}(}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00043}00043           \textcolor{keyword}{noexcept}(\mbox{\hyperlink{namespacekblib_a43cda388d529e7f9553850b366ef3380}{kblib::insertion\_sort}}(input\_copy.begin(), input\_copy.end())),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00044}00044           \textcolor{stringliteral}{"{}insertion\_sort for array<int> should be noexcept"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00045}00045    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00046}00046    SECTION(\textcolor{stringliteral}{"{}insertion\_sort\_copy"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00047}00047       std::remove\_const<\textcolor{keyword}{decltype}(input)>::type output;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00048}00048       \mbox{\hyperlink{namespacekblib_a654de993e7d26592cdc4e05443150296}{kblib::insertion\_sort\_copy}}(input.begin(), input.end(), output.begin(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00049}00049                                  output.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00050}00050       CHECK(output == goal);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00051}00051       \textcolor{keyword}{static\_assert}(}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00052}00052           \textcolor{keyword}{noexcept}(\mbox{\hyperlink{namespacekblib_a654de993e7d26592cdc4e05443150296}{kblib::insertion\_sort\_copy}}(input.begin(), input.end(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00053}00053                                               output.begin(), output.end())),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00054}00054           \textcolor{stringliteral}{"{}insertion\_sort\_copy for array<int> should be noexcept"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00055}00055    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00056}00056    SECTION(\textcolor{stringliteral}{"{}adaptive\_insertion\_sort\_copy"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00057}00057       std::remove\_const<\textcolor{keyword}{decltype}(input)>::type output;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00058}00058       \mbox{\hyperlink{namespacekblib_a707446076d1cc9e803e1041117924a73}{kblib::adaptive\_insertion\_sort\_copy}}(input.begin(), input.end(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00059}00059                                           output.begin(), output.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00060}00060       CHECK(output == goal);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00061}00061    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00062}00062    SECTION(\textcolor{stringliteral}{"{}insertion\_sort is stable"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00063}00063       std::minstd\_rand rng\{std::random\_device\{\}()\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00064}00064       std::uniform\_int\_distribution<int> dist(0, 8);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00065}00065       \textcolor{keywordflow}{for} ([[gnu::unused]] \textcolor{keyword}{auto} \_i : \mbox{\hyperlink{namespacekblib_a72690688922a2d4ae9a3e46ff0c1a9a9}{kblib::range}}(100)) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00066}00066          \textcolor{comment}{// sort based on first key, second is used to distinguish between equal}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00067}00067          \textcolor{comment}{// elements}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00068}00068          std::vector<std::pair<int, int>> inputs;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00069}00069          \textcolor{keyword}{auto} pcomp = [](\textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}, \textcolor{keyword}{auto} b) \{ \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}.first < b.first; \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00071}00071          \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00072}00072             std::map<int, int> counts;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00073}00073             \textcolor{keywordflow}{for} ([[gnu::unused]] \textcolor{keyword}{auto} \_j : \mbox{\hyperlink{namespacekblib_a72690688922a2d4ae9a3e46ff0c1a9a9}{kblib::range}}(100)) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00074}00074                \textcolor{keyword}{auto} r = dist(rng);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00075}00075                inputs.emplace\_back(r, counts[r]++);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00076}00076             \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00077}00077          \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00079}00079          \mbox{\hyperlink{namespacekblib_a43cda388d529e7f9553850b366ef3380}{kblib::insertion\_sort}}(inputs.begin(), inputs.end(), pcomp);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00081}00081          \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00082}00082             std::map<int, int> counts;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00083}00083             \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} p : inputs) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00084}00084                CHECK(p.second == counts[p.first]++);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00085}00085             \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00086}00086          \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00087}00087       \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00088}00088    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00089}00089    SECTION(\textcolor{stringliteral}{"{}insertion\_sort on random data"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00090}00090       std::minstd\_rand rng\{std::random\_device\{\}()\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00091}00091       std::uniform\_int\_distribution<int> dist(0, 65535);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00092}00092       \textcolor{keywordflow}{for} ([[gnu::unused]] \textcolor{keyword}{auto} \_i : \mbox{\hyperlink{namespacekblib_a72690688922a2d4ae9a3e46ff0c1a9a9}{kblib::range}}(100)) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00093}00093          std::vector<int> input2(100);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00094}00094          \mbox{\hyperlink{namespacekblib_a33f20e37682017226d1d7a7128915ea5}{std::generate}}(begin(input2), end(input2), [\&] \{ \textcolor{keywordflow}{return} dist(rng); \});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00095}00095 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00096}00096          \textcolor{keyword}{auto} output\_std = input2;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00097}00097          \mbox{\hyperlink{namespacekblib_1_1detail__sort_a3b873e1b1c2c3a4865638d2c904c4c1d}{std::sort}}(output\_std.begin(), output\_std.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00098}00098          \textcolor{keyword}{decltype}(input2) output\_kblib(input2.size());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00099}00099          \mbox{\hyperlink{namespacekblib_a654de993e7d26592cdc4e05443150296}{kblib::insertion\_sort\_copy}}(cbegin(input2), cend(input2),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00100}00100                                     output\_kblib.begin(), output\_kblib.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00101}00101          CHECK(output\_std == output\_kblib);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00102}00102       \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00103}00103    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00104}00104 \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00105}00105 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00106}00106 \textcolor{keyword}{static} std::ostream\& log\_location = std::cout;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00107}00107 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00108}\mbox{\hyperlink{sort_8cpp_a749843dabc021eefd1a3f9ce1f8873da}{00108}} \textcolor{keyword}{auto} \mbox{\hyperlink{sort_8cpp_a749843dabc021eefd1a3f9ce1f8873da}{linear}}(std::size\_t i) \{ \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(i); \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00110}\mbox{\hyperlink{sort_8cpp_ab59d3ab71834df87f0c921b5936bd019}{00110}} \mbox{\hyperlink{sort_8cpp_aff80d0822871626fe96948e69c4cc5b6}{TEST\_CASE}}(\textcolor{stringliteral}{"{}insertion sort performance"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00111}00111    \textcolor{keyword}{auto} time\_and\_log}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00112}00112        = [\&](\textcolor{keyword}{auto} line, \textcolor{keyword}{auto}\&\& f, std::size\_t quick = 30,}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00113}00113              std::size\_t slow = 10000, double (*O)(std::size\_t) = \mbox{\hyperlink{sort_8cpp_a749843dabc021eefd1a3f9ce1f8873da}{linear}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00114}00114             \textcolor{keyword}{auto} time\_fast = f(quick) / O(quick);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00115}00115             \textcolor{keyword}{auto} time\_slow = f(slow) / O(slow);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00116}00116             \textcolor{keyword}{auto} error = time\_slow / time\_fast;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00117}00117             log\_location << \_\_FILE\_\_ \textcolor{stringliteral}{"{}:"{}} << std::left << line << \textcolor{stringliteral}{"{}: \(\backslash\)t"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00118}00118                          << time\_fast << \textcolor{stringliteral}{"{}\(\backslash\)t "{}} << std::setw(12) << time\_slow}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00119}00119                          << \textcolor{charliteral}{'\(\backslash\)t'} << std::setw(14) << error << \textcolor{charliteral}{'\(\backslash\)t'}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00120}00120                          << time\_slow * 10000 << \textcolor{charliteral}{'\(\backslash\)t'} << time\_fast * 30 << \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00122}00122             \textcolor{comment}{// Can't overshoot the bound by more than 5\%:}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00123}00123             CHECK(error < 1.05);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00124}00124          \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00125}00125 \textcolor{preprocessor}{\#define TIME(...) time\_and\_log(\_\_LINE\_\_, \_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00126}00126 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00127}00127    SECTION(\textcolor{stringliteral}{"{}labels"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00128}00128       \textcolor{keyword}{using namespace }std::literals;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00129}00129       log\_location << \_\_FILE\_\_ \textcolor{stringliteral}{"{}:"{}} << std::left << \_\_LINE\_\_}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00130}00130                    << \textcolor{stringliteral}{"{}: \(\backslash\)t/el (30)\(\backslash\)t /el (10000)"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00131}00131                       \textcolor{stringliteral}{"{}\(\backslash\)tsuperlinearity\(\backslash\)ttotal (10000)\(\backslash\)t"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00132}00132                       \textcolor{stringliteral}{"{}total (30)\(\backslash\)n"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00133}00133                    << \mbox{\hyperlink{namespacekblib_afc6af3c7ee821bb25dd692bd2fc92adb}{kblib::repeat}}(\textcolor{stringliteral}{"{} -\/"{}}s, 60) << \textcolor{charliteral}{'\(\backslash\)n'};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00134}00134    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00135}00135 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00136}00136    SECTION(\textcolor{stringliteral}{"{}insertion\_sort\_copy on sorted data is fast"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00137}00137       \textcolor{keyword}{auto} time\_per = [](std::size\_t \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00138}00138          std::vector<int> input(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00139}00139          \textcolor{keyword}{decltype}(input) output(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00140}00140          \mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{std::iota}}(input.begin(), input.end(), 0);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00142}00142          \textcolor{keyword}{auto} start = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00143}00143          \mbox{\hyperlink{namespacekblib_a654de993e7d26592cdc4e05443150296}{kblib::insertion\_sort\_copy}}(input.cbegin(), input.cend(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00144}00144                                     output.begin(), output.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00145}00145          \textcolor{keyword}{auto} end = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00146}00146          \textcolor{keyword}{auto} duration = end -\/ start;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00147}00147          \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(duration.count());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00148}00148       \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00149}00149 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00150}00150       \mbox{\hyperlink{sort_8cpp_a48b288ccc4a32636f83220e7b7a79f82}{TIME}}(time\_per);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00151}00151    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00152}00152    SECTION(\textcolor{stringliteral}{"{}insertion\_sort\_copy on reverse sorted data is slow"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00153}00153       \textcolor{keyword}{auto} time\_per = [](std::size\_t \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00154}00154          std::vector<int> input(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00155}00155          \textcolor{keyword}{decltype}(input) output(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00156}00156          \mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{std::iota}}(input.rbegin(), input.rend(), 0);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00157}00157 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00158}00158          \textcolor{keyword}{auto} start = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00159}00159          \mbox{\hyperlink{namespacekblib_a654de993e7d26592cdc4e05443150296}{kblib::insertion\_sort\_copy}}(input.cbegin(), input.cend(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00160}00160                                     output.begin(), output.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00161}00161          \textcolor{keyword}{auto} end = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00162}00162          \textcolor{keyword}{auto} duration = end -\/ start;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00163}00163          \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(duration.count());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00164}00164       \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00165}00165 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00166}00166       \mbox{\hyperlink{sort_8cpp_a48b288ccc4a32636f83220e7b7a79f82}{TIME}}(}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00167}00167           time\_per, 30, 1000, +[](std::size\_t i) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00168}00168              \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(i) * \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(i);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00169}00169           \});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00170}00170    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00171}00171    SECTION(\textcolor{stringliteral}{"{}adaptive\_insertion\_sort\_copy on sorted data is fast"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00172}00172       \textcolor{keyword}{auto} time\_per = [](std::size\_t \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00173}00173          std::vector<int> input(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00174}00174          \textcolor{keyword}{decltype}(input) output(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00175}00175          \mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{std::iota}}(input.begin(), input.end(), 0);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00176}00176 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00177}00177          \textcolor{keyword}{auto} start = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00178}00178          \mbox{\hyperlink{namespacekblib_a707446076d1cc9e803e1041117924a73}{kblib::adaptive\_insertion\_sort\_copy}}(input.cbegin(), input.cend(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00179}00179                                              output.begin(), output.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00180}00180          \textcolor{keyword}{auto} end = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00181}00181          \textcolor{keyword}{auto} duration = end -\/ start;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00182}00182          \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(duration.count());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00183}00183       \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00184}00184 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00185}00185       \mbox{\hyperlink{sort_8cpp_a48b288ccc4a32636f83220e7b7a79f82}{TIME}}(time\_per);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00186}00186    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00187}00187    SECTION(\textcolor{stringliteral}{"{}adaptive\_insertion\_sort\_copy on reverse sorted data is fast"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00188}00188       \textcolor{keyword}{auto} time\_per = [](std::size\_t \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00189}00189          std::vector<int> input(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00190}00190          \textcolor{keyword}{decltype}(input) output(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00191}00191          \mbox{\hyperlink{namespacekblib_a40d0e463984f5ab01f6db106dbad9fb0}{std::iota}}(input.rbegin(), input.rend(), 0);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00193}00193          \textcolor{keyword}{auto} start = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00194}00194          \mbox{\hyperlink{namespacekblib_a707446076d1cc9e803e1041117924a73}{kblib::adaptive\_insertion\_sort\_copy}}(input.cbegin(), input.cend(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00195}00195                                              output.begin(), output.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00196}00196          \textcolor{keyword}{auto} end = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00197}00197          \textcolor{keyword}{auto} duration = end -\/ start;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00198}00198          \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(duration.count());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00199}00199       \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00200}00200 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00201}00201       \mbox{\hyperlink{sort_8cpp_a48b288ccc4a32636f83220e7b7a79f82}{TIME}}(time\_per);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00202}00202    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00203}00203    SECTION(\textcolor{stringliteral}{"{}insertion\_sort\_copy on mostly sorted data is fast"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00204}00204       std::minstd\_rand rng\{std::random\_device\{\}()\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00205}00205       \textcolor{keyword}{auto} time\_per = [\&](\textcolor{keywordtype}{int} ssize, \textcolor{keywordtype}{int} noise) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00206}00206          \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}} = \textcolor{keyword}{static\_cast<}std::size\_t\textcolor{keyword}{>}(ssize);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00207}00207          std::uniform\_int\_distribution<int> dist(-\/noise, noise);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00208}00208          std::vector<int> input(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00209}00209          \textcolor{keyword}{decltype}(input) output(\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00210}00210          \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} i : \mbox{\hyperlink{namespacekblib_a72690688922a2d4ae9a3e46ff0c1a9a9}{kblib::range}}(ssize)) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00211}00211             input[\mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{kblib::to\_unsigned}}(i)] = i + dist(rng);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00212}00212          \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00213}00213 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00214}00214          \textcolor{keyword}{auto} start = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00215}00215          \mbox{\hyperlink{namespacekblib_a654de993e7d26592cdc4e05443150296}{kblib::insertion\_sort\_copy}}(input.cbegin(), input.cend(),}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00216}00216                                     output.begin(), output.end());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00217}00217          \textcolor{keyword}{auto} end = std::chrono::high\_resolution\_clock::now();}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00218}00218          \textcolor{keyword}{auto} duration = end -\/ start;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00219}00219          \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(duration.count());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00220}00220       \};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00221}00221 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00222}00222       \textcolor{keyword}{auto} n = 10000;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00223}00223       \textcolor{comment}{// deviation by +/-\/ sqrt(n)}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00224}00224       \textcolor{keyword}{auto} v = 100;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00225}00225 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00226}00226       \textcolor{keyword}{using namespace }std::literals;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00227}00227       log\_location << \mbox{\hyperlink{namespacekblib_afc6af3c7ee821bb25dd692bd2fc92adb}{kblib::repeat}}(\textcolor{stringliteral}{"{} -\/"{}}s, 60) << \textcolor{charliteral}{'\(\backslash\)n'}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00228}00228                    << \_\_FILE\_\_ \textcolor{stringliteral}{"{}:"{}} << std::left << \_\_LINE\_\_}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00229}00229                    << \textcolor{stringliteral}{"{}: \(\backslash\)t/el (s) \(\backslash\)t /el (v)    "{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00230}00230                       \textcolor{stringliteral}{"{}\(\backslash\)tsuperlinearity\(\backslash\)ttotal (v)    \(\backslash\)t"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00231}00231                       \textcolor{stringliteral}{"{}total (s)\(\backslash\)n"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00232}00232                    << \mbox{\hyperlink{namespacekblib_afc6af3c7ee821bb25dd692bd2fc92adb}{kblib::repeat}}(\textcolor{stringliteral}{"{} -\/"{}}s, 60) << \textcolor{charliteral}{'\(\backslash\)n'};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00233}00233 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00234}00234       \textcolor{keyword}{auto} time\_fast = time\_per(n, 0) / n;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00235}00235       \textcolor{keyword}{auto} time\_slow = time\_per(n, v) / n;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00236}00236       \textcolor{keyword}{auto} ratio = time\_slow / time\_fast;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00237}00237       \textcolor{keyword}{auto} error = ratio / (n / v);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00238}00238 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00239}00239       log\_location << \_\_FILE\_\_ \textcolor{stringliteral}{"{}:"{}} << std::left << \_\_LINE\_\_ << \textcolor{stringliteral}{"{}: \(\backslash\)t"{}}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00240}00240                    << time\_fast << \textcolor{stringliteral}{"{}\(\backslash\)t "{}} << std::setw(12) << time\_slow << \textcolor{charliteral}{'\(\backslash\)t'}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00241}00241                    << std::setw(14) << error << \textcolor{charliteral}{'\(\backslash\)t'} << time\_slow * 10000}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00242}00242                    << \textcolor{charliteral}{'\(\backslash\)t'} << time\_fast * 30 << \textcolor{stringliteral}{"{}\(\backslash\)n"{}};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00243}00243 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00244}00244       \textcolor{comment}{// Can't overshoot the bound by more than 5\%:}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00245}00245       CHECK(error < 1.05);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00246}00246    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00247}00247    log\_location << std::flush;}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00248}00248 \textcolor{preprocessor}{\#undef TIME}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00249}00249 \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00251}\mbox{\hyperlink{sort_8cpp_a583b0027d521862f860a8a5a515be6ad}{00251}} \mbox{\hyperlink{sort_8cpp_aff80d0822871626fe96948e69c4cc5b6}{TEST\_CASE}}(\textcolor{stringliteral}{"{}byte extraction"{}}) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00252}00252    \textcolor{keyword}{constexpr} std::uint32\_t x\{0xAB23CD67\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00253}00253 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00254}00254    \textcolor{keyword}{static\_assert}(std::numeric\_limits<std::uint32\_t>::digits}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00255}00255                      == \textcolor{keyword}{sizeof}(uint32\_t) * CHAR\_BIT,}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00256}00256                  \textcolor{stringliteral}{"{}these checks assume uint32\_t does not have padding."{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00257}00257    \textcolor{keyword}{static\_assert}(CHAR\_BIT == 8, \textcolor{stringliteral}{"{}these checks assume 8-\/bit bytes"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00258}00258 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00259}00259    \textcolor{keyword}{static\_assert}(\mbox{\hyperlink{namespacekblib_a407763ccb393b23e4d9616cd76f03fe5}{kblib::byte\_count}}(x) == \textcolor{keyword}{sizeof}(x), \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00260}00260    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(x, 0) == 0x67, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00261}00261    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(x, 1) == 0xCD, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00262}00262    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(x, 2) == 0x23, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00263}00263    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(x, 3) == 0xAB, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00264}00264 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00265}00265    std::string str\{\textcolor{stringliteral}{"{}0123456789"{}}\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00266}00266    CHECK(\mbox{\hyperlink{namespacekblib_a407763ccb393b23e4d9616cd76f03fe5}{kblib::byte\_count}}(str) == str.length());}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00267}00267    \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} i : \mbox{\hyperlink{namespacekblib_a72690688922a2d4ae9a3e46ff0c1a9a9}{kblib::range}}(str.length())) \{}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00268}00268       CHECK((\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(str, i)) == str[i]);}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00269}00269    \}}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00270}00270 }
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00271}00271    \textcolor{keyword}{constexpr} std::array<std::int32\_t, 2> arr\{0x10325476,}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00272}00272                                              std::int32\_t(0x98BADCFE)\};}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00273}00273    \textcolor{keyword}{static\_assert}(\mbox{\hyperlink{namespacekblib_a407763ccb393b23e4d9616cd76f03fe5}{kblib::byte\_count}}(arr) == 8, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00274}00274    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 0) == 0x76, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00275}00275    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 1) == 0x54, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00276}00276    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 2) == 0x32, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00277}00277    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 3) == 0x10, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00278}00278    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 4) == 0xFE, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00279}00279    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 5) == 0xDC, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00280}00280    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 6) == 0xBA, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00281}00281    \textcolor{keyword}{static\_assert}(+\mbox{\hyperlink{namespacekblib_ae8bc9b87eff6f20b23a0da335c9501b9}{kblib::get\_byte\_index}}(arr, 7) == 0x98, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{sort_8cpp_source_l00282}00282 \}}

\end{DoxyCode}
