\hypertarget{simple_8h_source}{}\doxysection{simple.\+h}
\label{simple_8h_source}\index{kblib/simple.h@{kblib/simple.h}}
\mbox{\hyperlink{simple_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00001}00001 \textcolor{comment}{/* *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00002}00002 \textcolor{comment}{ * kblib is a general utility library for C++14 and C++17, intended to provide}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00003}00003 \textcolor{comment}{ * performant high-\/level abstractions and more expressive ways to do simple}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00004}00004 \textcolor{comment}{ * things.}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2021 killerbee}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00008}00008 \textcolor{comment}{ * This program is free software: you can redistribute it and/or modify}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00009}00009 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00010}00010 \textcolor{comment}{ * the Free Software Foundation, either version 3 of the License, or}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00011}00011 \textcolor{comment}{ * (at your option) any later version.}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00013}00013 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00014}00014 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00015}00015 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00016}00016 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00017}00017 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00018}00018 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00019}00019 \textcolor{comment}{ * along with this program.  If not, see <https://www.gnu.org/licenses/>.}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00020}00020 \textcolor{comment}{ * ****************************************************************************/}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00021}00021 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00032}00032 \textcolor{preprocessor}{\#ifndef KBLIB\_SIMPLE\_H}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00033}00033 \textcolor{preprocessor}{\#define KBLIB\_SIMPLE\_H}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00034}00034 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00035}00035 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{iterators_8h}{iterators.h}}"{}}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00037}00037 \textcolor{preprocessor}{\#include <bitset>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00038}00038 \textcolor{preprocessor}{\#include <climits>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00039}00039 \textcolor{preprocessor}{\#include <cstdint>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00040}00040 \textcolor{preprocessor}{\#include <initializer\_list>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00041}00041 \textcolor{preprocessor}{\#include <limits>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00042}00042 \textcolor{preprocessor}{\#include <numeric>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00043}00043 \textcolor{preprocessor}{\#include <utility>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00044}00044 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00045}\mbox{\hyperlink{simple_8h_af39ee5353ef0565c8970b7a3a3e9ca14}{00045}} \textcolor{preprocessor}{\#define KBLIB\_DEBUG\_LOG\_RANGES 0}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00046}00046 \textcolor{preprocessor}{\#if KBLIB\_DEBUG\_LOG\_RANGES}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00047}00047 \textcolor{preprocessor}{\#  include <iostream>}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00048}00048 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00049}00049 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00050}00050 \textcolor{keyword}{namespace }\mbox{\hyperlink{tdecl_8h_a4b5c574c663a392148218cd4410fd7a1}{KBLIB\_NS}} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00051}00051 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00052}\mbox{\hyperlink{namespacekblib_1_1detail__simple}{00052}} \textcolor{keyword}{namespace }detail\_simple \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00053}00053    \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00054}\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range}{00054}}    \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range}{simple\_range}} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00055}\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_ab484cd20140b2f5fcec4e102eb4d853a}{00055}}       \textcolor{keyword}{const} T\& \mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_ab484cd20140b2f5fcec4e102eb4d853a}{low}};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00056}\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_abf97c1b98489886b1b55bbf85362f75d}{00056}}       \textcolor{keyword}{const} T\& \mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_abf97c1b98489886b1b55bbf85362f75d}{high}};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00057}00057    \};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00058}00058 \} \textcolor{comment}{// namespace detail\_simple}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00060}00060 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00061}\mbox{\hyperlink{namespacekblib_a0657f89209aa9c1f4c95ce00e2744f24}{00061}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a0657f89209aa9c1f4c95ce00e2744f24}{in\_range}}(\textcolor{keyword}{const} T\& v, \mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range}{detail\_simple::simple\_range<T>}} r) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00062}00062    \textcolor{keywordflow}{return} (r.\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_ab484cd20140b2f5fcec4e102eb4d853a}{low}} <= v) and (v < r.\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_abf97c1b98489886b1b55bbf85362f75d}{high}});}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00063}00063 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00064}00064 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00065}\mbox{\hyperlink{namespacekblib_afef50b8a478317dbcbc249e688f6e93b}{00065}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_afef50b8a478317dbcbc249e688f6e93b}{in\_range\_i}}(\textcolor{keyword}{const} T\& v, \mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range}{detail\_simple::simple\_range<T>}} r) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00066}00066    \textcolor{keywordflow}{return} (r.\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_ab484cd20140b2f5fcec4e102eb4d853a}{low}} <= v) and (v <= r.\mbox{\hyperlink{structkblib_1_1detail__simple_1_1simple__range_abf97c1b98489886b1b55bbf85362f75d}{high}});}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00067}00067 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00068}00068 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00069}00069 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00071}00071 \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00072}\mbox{\hyperlink{namespacekblib_aba974d3674b8fe6b1cf75e16a66322f0}{00072}} \textcolor{keyword}{constexpr} \textcolor{keywordtype}{bool} \mbox{\hyperlink{namespacekblib_aba974d3674b8fe6b1cf75e16a66322f0}{any\_void}} = (std::is\_void\_v<Ts> or ...);}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00074}00074 \textcolor{keyword}{template} <\textcolor{keyword}{typename} F, \textcolor{keyword}{typename}... T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00075}\mbox{\hyperlink{namespacekblib_a1490492d82c28f195f0f44a9d88fb2cc}{00075}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a1490492d82c28f195f0f44a9d88fb2cc}{map}}(F f, T\&\&... t) \textcolor{keyword}{noexcept}(\textcolor{keyword}{noexcept}(std::tuple\{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00076}00076     \mbox{\hyperlink{namespacekblib_a3873199be1651ec4e0fda92171b2b82c}{kblib::apply}}(f, std::forward<T>(t))...\}))}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00077}00077     -\/> \mbox{\hyperlink{namespacekblib_a366272ad8baad19be4ccf8128afb04a3}{enable\_if\_t}}<}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00078}00078         not any\_void<decltype(kblib::apply(f, std::forward<T>(t)))...>,}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00079}00079         \textcolor{keyword}{decltype}(std::tuple\{\mbox{\hyperlink{namespacekblib_a3873199be1651ec4e0fda92171b2b82c}{kblib::apply}}(f, std::forward<T>(t))...\})> \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00080}00080    \textcolor{keywordflow}{return} std::tuple\{\mbox{\hyperlink{namespacekblib_a3873199be1651ec4e0fda92171b2b82c}{kblib::apply}}(f, std::forward<T>(t))...\};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00081}00081 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00082}00082 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00083}00083 \textcolor{keyword}{template} <\textcolor{keyword}{typename} F, \textcolor{keyword}{typename}... T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00084}00084 \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a1490492d82c28f195f0f44a9d88fb2cc}{map}}(F f, T\&\&... t) \textcolor{keyword}{noexcept}(}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00085}00085     \textcolor{keyword}{noexcept}((\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{void}\textcolor{keyword}{>}(\mbox{\hyperlink{namespacekblib_a3873199be1651ec4e0fda92171b2b82c}{kblib::apply}}(f, std::forward<T>(t))), ...)))}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00086}00086     -\/> enable\_if\_t<any\_void<decltype(kblib::apply(f, std::forward<T>(t)))...>,}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00087}00087                    \textcolor{keywordtype}{void}> \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00088}00088    (\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{void}\textcolor{keyword}{>}(\mbox{\hyperlink{namespacekblib_a3873199be1651ec4e0fda92171b2b82c}{kblib::apply}}(f, std::forward<T>(t))), ...);}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00089}00089 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00090}00090 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00091}00091 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00092}00092 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00093}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{00093}} \textcolor{keyword}{struct }\mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper}} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00094}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_aa2df25888b4aa704df8e9fd44ed3668b}{00094}}    T \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_aa2df25888b4aa704df8e9fd44ed3668b}{t}};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00095}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_ab93687fb07382e43c5398f396bd38ca8}{00095}}    \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_ab93687fb07382e43c5398f396bd38ca8}{\string~RAII\_wrapper}}() noexcept(noexcept(t())) \{ t(); \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00096}00096 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00097}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a2537cc6c9879646e9df9cb276ac87d4a}{00097}}    \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a2537cc6c9879646e9df9cb276ac87d4a}{RAII\_wrapper}}(T\&\& t\_)}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00098}00098        : t(\mbox{\hyperlink{namespacestd}{std}}::\mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7aa3734a903022249b3010be1897042568e}{move}}(t\_)) \{\}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00099}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a4e26ed010245c0392d94913005b15bbd}{00099}}    \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a4e26ed010245c0392d94913005b15bbd}{RAII\_wrapper}}(\textcolor{keyword}{const} T\& t\_)}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00100}00100        : t(t\_) \{\}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00101}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a2f5cb5f4c88796c8873cba92977ffce7}{00101}}    \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a2f5cb5f4c88796c8873cba92977ffce7}{RAII\_wrapper}}(\textcolor{keyword}{const} \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper}}\&) = \textcolor{keyword}{delete};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00102}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a73a33446f1df2219c3f5834d3c0fe34e}{00102}}    \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a73a33446f1df2219c3f5834d3c0fe34e}{RAII\_wrapper}}(\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper}}\&\&) = \textcolor{keyword}{delete};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00103}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a48361eef63d83ff9dabcae099cf5f826}{00103}}    \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper}}\& \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_a48361eef63d83ff9dabcae099cf5f826}{operator=}}(\textcolor{keyword}{const} \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper}}\&) = \textcolor{keyword}{delete};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00104}\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_ace9bb342591b14c434816ed449f942ef}{00104}}    \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper}}\& \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper_ace9bb342591b14c434816ed449f942ef}{operator=}}(\mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper}}\&\&) = \textcolor{keyword}{delete};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00105}00105 \};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00107}00107 \textcolor{keyword}{template} <\textcolor{keyword}{typename} F>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00108}\mbox{\hyperlink{namespacekblib_a87e300394cbdcefd780d0904b31f4c07}{00108}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a87e300394cbdcefd780d0904b31f4c07}{defer}}(F f) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00109}00109    \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1_r_a_i_i__wrapper}{RAII\_wrapper<F>}}\{std::move(f)\};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00110}00110 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00111}00111 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00121}00121 \textcolor{keyword}{template} <\textcolor{keyword}{typename} BinaryOperation>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00122}\mbox{\hyperlink{namespacekblib_ac4b288376b8a5fcf8fceba9e426a45fa}{00122}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ab2c94cb864bd6de586bfd329e515df32}{flip}}() -\/> \textcolor{keyword}{auto} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00123}00123    \textcolor{keywordflow}{return} [](\textcolor{keyword}{auto}\&\& \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}, \textcolor{keyword}{auto}\&\& b) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00124}00124       \textcolor{keywordflow}{return} BinaryOperation\{\}(\textcolor{keyword}{static\_cast<}decltype(b)\textcolor{keyword}{>}(b),}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00125}00125                                \textcolor{keyword}{static\_cast<}decltype(\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}})\textcolor{keyword}{>}(\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}));}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00126}00126    \};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00127}00127 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00128}00128 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00137}00137 \textcolor{keyword}{template} <\textcolor{keyword}{typename} BinaryOperation>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00138}\mbox{\hyperlink{namespacekblib_ab2c94cb864bd6de586bfd329e515df32}{00138}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ab2c94cb864bd6de586bfd329e515df32}{flip}}(BinaryOperation op) -\/> \textcolor{keyword}{auto} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00139}00139    \textcolor{keywordflow}{return} [op = std::move(op)](\textcolor{keyword}{auto}\&\& \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}, \textcolor{keyword}{auto}\&\& b) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00140}00140       \textcolor{keywordflow}{return} op(\textcolor{keyword}{static\_cast<}decltype(b)\textcolor{keyword}{>}(b), \textcolor{keyword}{static\_cast<}decltype(\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}})\textcolor{keyword}{>}(\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}));}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00141}00141    \};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00142}00142 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00143}00143 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00144}00144 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T, std::\textcolor{keywordtype}{size\_t} N>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00145}\mbox{\hyperlink{namespacekblib_a0f3921343096a5041fd08ecf6287701a}{00145}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a0f3921343096a5041fd08ecf6287701a}{is\_consecutive}}(\textcolor{keyword}{const} T (\&array)[N])}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00146}00146     -\/> \mbox{\hyperlink{namespacekblib_a366272ad8baad19be4ccf8128afb04a3}{enable\_if\_t<std::is\_integral<T>::value}}, \textcolor{keywordtype}{bool}> \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00147}00147    \textcolor{keywordflow}{if} (N <= 1) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00148}00148       \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00149}00149    \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (N == 2) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00150}00150       \textcolor{keywordflow}{return} (array[1] -\/ array[0]) == 1;}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00151}00151    \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00152}00152       \textcolor{keywordflow}{for} (std::size\_t i = 1; i < N; ++i) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00153}00153          \textcolor{keywordflow}{if} ((array[i] -\/ array[i -\/ 1]) != 1) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00154}00154             \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00155}00155          \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00156}00156       \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00157}00157       \textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00158}00158    \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00159}00159 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00160}00160 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00166}\mbox{\hyperlink{namespacekblib_a5633a966716e66c8230d039c7615e393}{00166}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a5633a966716e66c8230d039c7615e393}{filg2}}(}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00167}00167     \textcolor{keyword}{const} std::bitset<std::numeric\_limits<std::uintmax\_t>::digits> val) \textcolor{keyword}{noexcept}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00168}00168     -\/> \textcolor{keywordtype}{int} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00169}00169    \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} i : range<int>(\mbox{\hyperlink{namespacekblib_a1909a64960663825ccc4eb98e4637df2}{to\_signed}}(val.size()) -\/ 1, 0, -\/1)) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00170}00170       \textcolor{keywordflow}{if} (val[\mbox{\hyperlink{namespacekblib_af9e250fffa2922e623baa08aa8994f54}{to\_unsigned}}(i)])}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00171}00171          \textcolor{keywordflow}{return} i;}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00172}00172    \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00173}00173    \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00174}00174 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00175}00175 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00176}00176 \textcolor{keyword}{template} <std::size\_t \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}, \textcolor{keyword}{typename} T, \textcolor{keyword}{typename}... Ts>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00177}\mbox{\hyperlink{structkblib_1_1first__bigger__than}{00177}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1first__bigger__than}{first\_bigger\_than}}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00178}00178     : std::conditional<sizeof(T) >= \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}, \mbox{\hyperlink{structkblib_1_1detail_1_1tag}{detail::tag}}<T>,}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00179}00179                        typename \mbox{\hyperlink{structkblib_1_1first__bigger__than}{first\_bigger\_than}}<size, Ts...>::type> \{\};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00180}00180 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00181}00181 \textcolor{keyword}{template} <std::\textcolor{keywordtype}{size\_t} size, \textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00182}\mbox{\hyperlink{structkblib_1_1first__bigger__than_3_01size_00_01_t_01_4}{00182}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1first__bigger__than}{first\_bigger\_than}}<\mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}, T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00183}00183     : std::conditional\_t<sizeof(T) >= \mbox{\hyperlink{namespacekblib_1_1fakestd_adb8781bc0e5d1ba4ca4624293c0c98ae}{size}}, \mbox{\hyperlink{structkblib_1_1detail_1_1tag}{detail::tag}}<T>, void> \{\};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00184}00184 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00185}00185 \textcolor{keyword}{template} <std::u\textcolor{keywordtype}{int}max\_t I>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00186}\mbox{\hyperlink{namespacekblib_af598d7431e3f5b0be999dc7cb1ddca42}{00186}} \textcolor{keyword}{using }\mbox{\hyperlink{namespacekblib_af598d7431e3f5b0be999dc7cb1ddca42}{uint\_smallest}} =}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00187}00187     \textcolor{keyword}{typename} \mbox{\hyperlink{structkblib_1_1first__bigger__than}{first\_bigger\_than}}<1 + \mbox{\hyperlink{namespacekblib_a5633a966716e66c8230d039c7615e393}{filg2}}(I) / CHAR\_BIT, \textcolor{keywordtype}{unsigned} char,}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00188}00188                                \textcolor{keywordtype}{unsigned} short, \textcolor{keywordtype}{unsigned} int, \textcolor{keywordtype}{unsigned} long,}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00189}00189                                \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} long, std::uintmax\_t>::type;}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00190}00190 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00191}00191 \textcolor{keyword}{template} <std::u\textcolor{keywordtype}{int}max\_t I>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00192}\mbox{\hyperlink{namespacekblib_a01bce53d45632d6f32fe5af269533805}{00192}} \textcolor{keyword}{using }\mbox{\hyperlink{namespacekblib_a01bce53d45632d6f32fe5af269533805}{int\_smallest}} =}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00193}00193     \textcolor{keyword}{typename} \mbox{\hyperlink{structkblib_1_1first__bigger__than}{first\_bigger\_than}}<1 + (\mbox{\hyperlink{namespacekblib_a5633a966716e66c8230d039c7615e393}{filg2}}(I) + 1) / CHAR\_BIT, \textcolor{keywordtype}{signed} \textcolor{keywordtype}{char},}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00194}00194                                \textcolor{keywordtype}{signed} \textcolor{keywordtype}{short}, \textcolor{keywordtype}{signed} \textcolor{keywordtype}{int}, \textcolor{keywordtype}{signed} \textcolor{keywordtype}{long},}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00195}00195                                \textcolor{keywordtype}{signed} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long}, std::uintmax\_t>::type;}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00196}00196 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00197}00197 \textcolor{keyword}{template} <std::u\textcolor{keywordtype}{int}max\_t I>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00198}\mbox{\hyperlink{namespacekblib_af6581571367a6b54af65b1174c2f416f}{00198}} \textcolor{keyword}{using }\mbox{\hyperlink{namespacekblib_af6581571367a6b54af65b1174c2f416f}{uint\_smallest\_t}} = \textcolor{keyword}{typename} \mbox{\hyperlink{namespacekblib_af598d7431e3f5b0be999dc7cb1ddca42}{uint\_smallest<I>::type}};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00200}00200 \textcolor{keyword}{template} <std::u\textcolor{keywordtype}{int}max\_t I>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00201}\mbox{\hyperlink{namespacekblib_a54235123af1b79489fb0484fc64318ff}{00201}} \textcolor{keyword}{using }\mbox{\hyperlink{namespacekblib_a54235123af1b79489fb0484fc64318ff}{int\_smallest\_t}} = \textcolor{keyword}{typename} \mbox{\hyperlink{namespacekblib_a01bce53d45632d6f32fe5af269533805}{int\_smallest<I>::type}};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00202}00202 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00206}\mbox{\hyperlink{structkblib_1_1identity}{00206}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1identity}{identity}} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00207}00207    \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00208}\mbox{\hyperlink{structkblib_1_1identity_a9072a8c64572423fab682367b6251450}{00208}}    \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} \mbox{\hyperlink{structkblib_1_1identity_a9072a8c64572423fab682367b6251450}{operator()}}(T\&\& in) -\/> T\&\& \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00209}00209       \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}T\&\&\textcolor{keyword}{>}(in);}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00210}00210    \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00211}00211 \};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00212}00212 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00216}00216 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00217}\mbox{\hyperlink{namespacekblib_a535ff4e383fdfe8e07c637d574b68008}{00217}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a5b06c53a850d4a275c26a068b907caeb}{safe\_auto}}(T\&\& in) -\/> T \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00218}00218    \textcolor{keywordflow}{return} std::forward<T>(in);}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00219}00219 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00220}00220 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00224}00224 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00225}\mbox{\hyperlink{namespacekblib_a5b06c53a850d4a275c26a068b907caeb}{00225}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a5b06c53a850d4a275c26a068b907caeb}{safe\_auto}}(T\& in) -\/> T\& \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00226}00226    \textcolor{keywordflow}{return} in;}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00227}00227 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00228}00228 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00236}00236 \textcolor{keyword}{template} <\textcolor{keyword}{typename} LeftContainer, \textcolor{keyword}{typename} RightContainer>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00237}\mbox{\hyperlink{namespacekblib_a4b5107514451c00067d9ec0c58721009}{00237}} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a4b5107514451c00067d9ec0c58721009}{arraycat}}(LeftContainer A, RightContainer\&\& B) \textcolor{keyword}{noexcept}(}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00238}00238     \textcolor{keyword}{noexcept}(A.insert(A.end(), B.begin(), B.end()))}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00239}00239     and std::is\_nothrow\_move\_constructible<LeftContainer>::value)}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00240}00240     -\/> LeftContainer \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00241}00241    A.insert(A.end(), B.begin(), B.end());}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00242}00242    \textcolor{keywordflow}{return} std::move(A);}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00243}00243 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00244}00244 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00254}00254 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00255}\mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{00255}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}(\textcolor{keyword}{const} std::initializer\_list<T>\& \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}) -\/> \textcolor{keyword}{auto} \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00256}00256    \textcolor{keywordflow}{return} \mbox{\hyperlink{namespacekblib_a22831dce77d5f35c13930b5e30a59f07}{a}}.begin();}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00257}00257 \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00258}00258 \textcolor{comment}{// use like:}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00259}00259 \textcolor{comment}{// auto v = a(\{2, 3, 5, 7, 9, 11\})[2];}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00260}00260 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00261}00261 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX20}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00262}00262 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00263}00263 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00264}00264 \textcolor{keyword}{concept }zero\_constructible = \textcolor{keyword}{requires}(T t) \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00265}00265    \{t = 0\};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00266}00266 \};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00268}00268 \textcolor{keyword}{struct }zero\_t \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00269}00269    \textcolor{keyword}{consteval} zero\_t(\textcolor{keywordtype}{int} i) \{ i == 0 ? void() : throw 0; \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00270}00270    \textcolor{keyword}{template} <zero\_constructible T>}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00271}00271    \textcolor{keyword}{constexpr} \textcolor{keyword}{operator} T() const noexcept \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00272}00272       \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00273}00273    \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00274}00274    \textcolor{keyword}{explicit} \textcolor{keyword}{constexpr} \textcolor{keyword}{operator} std::nullptr\_t() const noexcept \{}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00275}00275       \textcolor{keywordflow}{return} \textcolor{keyword}{nullptr};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00276}00276    \}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00277}00277 \};}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00278}00278 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00279}00279 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00280}00280 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00281}00281 \} \textcolor{comment}{// namespace KBLIB\_NS}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00282}00282 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00283}00283 \textcolor{preprocessor}{\#undef KBLIB\_DEBUG\_LOG\_RANGES}}
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00284}00284 }
\DoxyCodeLine{\Hypertarget{simple_8h_source_l00285}00285 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// KBLIB\_SIMPLE\_H}}

\end{DoxyCode}
