58 lines
5.2 KiB
TeX

\doxysection{template\+\_\+utils.\+h}
\hypertarget{template__utils_8h_source}{}\label{template__utils_8h_source}\mbox{\hyperlink{template__utils_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00002\ \textcolor{comment}{//\ Copyright\ 2024\ Medusa\ Slockbower}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ Licensed\ under\ the\ Apache\ License,\ Version\ 2.0\ (the\ "{}License"{});}}
\DoxyCodeLine{00004\ \textcolor{comment}{//\ you\ may\ not\ use\ this\ file\ except\ in\ compliance\ with\ the\ License.}}
\DoxyCodeLine{00005\ \textcolor{comment}{//\ You\ may\ obtain\ a\ copy\ of\ the\ License\ at}}
\DoxyCodeLine{00006\ \textcolor{comment}{//}}
\DoxyCodeLine{00007\ \textcolor{comment}{//\ \ http://www.apache.org/licenses/LICENSE-\/2.0}}
\DoxyCodeLine{00008\ \textcolor{comment}{//}}
\DoxyCodeLine{00009\ \textcolor{comment}{//\ Unless\ required\ by\ applicable\ law\ or\ agreed\ to\ in\ writing,\ software}}
\DoxyCodeLine{00010\ \textcolor{comment}{//\ distributed\ under\ the\ License\ is\ distributed\ on\ an\ "{}AS\ IS"{}\ BASIS,}}
\DoxyCodeLine{00011\ \textcolor{comment}{//\ WITHOUT\ WARRANTIES\ OR\ CONDITIONS\ OF\ ANY\ KIND,\ either\ express\ or\ implied.}}
\DoxyCodeLine{00012\ \textcolor{comment}{//\ See\ the\ License\ for\ the\ specific\ language\ governing\ permissions\ and}}
\DoxyCodeLine{00013\ \textcolor{comment}{//\ limitations\ under\ the\ License.}}
\DoxyCodeLine{00014\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#ifndef\ TEMPLATEUTILS\_H}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#define\ TEMPLATEUTILS\_H}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{keyword}{namespace\ }open\_cpp\_utils}
\DoxyCodeLine{00020\ \{}
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00032\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T,\ T\ V>}
\DoxyCodeLine{00033\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{constant\_value}}}
\DoxyCodeLine{00034\ \{}
\DoxyCodeLine{00035\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ T;}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ type\ value\ =\ V;}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{operator}\ type()\ \textcolor{keyword}{const}\ \textcolor{keyword}{noexcept}\ \{\ \textcolor{keywordflow}{return}\ value;\ \}}
\DoxyCodeLine{00039\ \ \ \ \ [[nodiscard]]\ \textcolor{keyword}{constexpr}\ type\ operator()()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ value;\ \}}
\DoxyCodeLine{00040\ \};}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00046\ \textcolor{keyword}{template}<\textcolor{keywordtype}{bool}\ V>}
\DoxyCodeLine{00047\ \textcolor{keyword}{using\ }\mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{bool\_constant}}\ =\ \mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{constant\_value<bool,\ V>}};}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ \textcolor{keyword}{using\ }\mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{true\_type}}\ \ =\ \mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{bool\_constant<true>}};\ }
\DoxyCodeLine{00050\ \textcolor{keyword}{using\ }\mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{false\_type}}\ =\ \mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{bool\_constant<false>}};\ }
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00055\ \textcolor{keyword}{template}<\textcolor{keyword}{typename},\ \textcolor{keyword}{typename}>}
\DoxyCodeLine{00056\ \textcolor{keyword}{inline}\ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_same\ =\ \mbox{\hyperlink{structopen__cpp__utils_1_1constant__value}{false\_type}}\{\};}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00061\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00062\ \textcolor{keyword}{inline}\ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_same<T,\ T>\ =\ true\_type\{\};}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00068\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}...Ts>}
\DoxyCodeLine{00069\ \textcolor{keyword}{inline}\ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_unique\ =\ \mbox{\hyperlink{template__utils_8h_ae3d98e273a29dae107e182245e79ed5a}{true\_type}}\{\};}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}...Ts>}
\DoxyCodeLine{00072\ \textcolor{keyword}{inline}\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_unique<T,\ Ts...>\ =\ \mbox{\hyperlink{template__utils_8h_a74d5cb86637293f20ed9afa2d8b31b2c}{bool\_constant}}<(!is\_same<T,\ Ts>\ \&\&\ ...)\ \&\&\ is\_unique<Ts...>>\{\};}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ \}}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00076\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//TEMPLATEUTILS\_H}}
\end{DoxyCode}