64 lines
6.2 KiB
TeX

\doxysection{Any.\+h}
\hypertarget{_any_8h_source}{}\label{_any_8h_source}\index{Include/Utility/Any.h@{Include/Utility/Any.h}}
\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\ ANY\_H}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#define\ ANY\_H}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <\mbox{\hyperlink{_template_utils_8h}{Utility/TemplateUtils.h}}>}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}...Ts>\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_any}{Any}};}
\DoxyCodeLine{00022\ }
\DoxyCodeLine{00026\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}...Rest>}
\DoxyCodeLine{00027\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_any}{Any}}<T,\ Rest...>\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{class_any}{Any}}<Rest...>}
\DoxyCodeLine{00028\ \{}
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{comment}{//\ Ensure\ each\ element\ is\ unique}}
\DoxyCodeLine{00030\ \ \ \ \ \textcolor{keyword}{static\_assert}(IsUnique<Rest...>);}
\DoxyCodeLine{00031\ \ \ \ \ \textcolor{keyword}{using\ }ThisType\ =\ T;}
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keyword}{using\ }\mbox{\hyperlink{class_any}{BaseType}}\ =\ \mbox{\hyperlink{class_any}{Any}}<Rest...>;}
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00035\ \ \ \ \ \mbox{\hyperlink{class_any}{Any}}()\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{class_any}{BaseType}}()\ \ \ \ \ \ \ \ ,\ Value()\ \{\ \}}
\DoxyCodeLine{00036\ \ \ \ \ \mbox{\hyperlink{class_any}{Any}}(\textcolor{keyword}{const}\ ThisType\&\ value,\ \textcolor{keyword}{const}\ Rest\&...other)\ \ \ :\ \mbox{\hyperlink{class_any}{BaseType}}(other...),\ Value(value)\ \{\ \}}
\DoxyCodeLine{00037\ \ \ \ \ \mbox{\hyperlink{class_any}{Any}}(ThisType\&\&\ value,\ Rest\&\&...other)\ \ \ \ \ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{class_any}{BaseType}}(other...),\ Value(value)\ \{\ \}}
\DoxyCodeLine{00038\ \ \ \ \ \mbox{\hyperlink{class_any}{Any}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_any}{Any}}\&\ other)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00039\ \ \ \ \ \mbox{\hyperlink{class_any}{Any}}(\mbox{\hyperlink{class_any}{Any}}\&\&\ other)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00040\ \ \ \ \ \mbox{\hyperlink{class_any}{\string~Any}}()\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \ \ \ \ \mbox{\hyperlink{class_any}{Any}}\&\ operator=(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_any}{Any}}\&)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00043\ \ \ \ \ \mbox{\hyperlink{class_any}{Any}}\&\ operator=(\mbox{\hyperlink{class_any}{Any}}\&\&)\ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keyword}{operator}\ \ \ \ \ \ \ ThisType\ \ ()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \ Value;\ \}}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keyword}{operator}\ \ \ \ \ \ \ ThisType\&\ ()\ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ \ Value;\ \}}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keyword}{operator}\ \textcolor{keyword}{const}\ ThisType\&\ ()\ \textcolor{keyword}{const}\ \{\ \textcolor{keywordflow}{return}\ \ Value;\ \}}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keyword}{operator}\ \ \ \ \ \ \ ThisType\&\&()\ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ \ Value;\ \}}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keyword}{operator}\ \ \ \ \ \ \ ThisType*\ ()\ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ \&Value;\ \}}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keyword}{operator}\ \textcolor{keyword}{const}\ ThisType*\ ()\ \textcolor{keyword}{const}\ \{\ \textcolor{keywordflow}{return}\ \&Value;\ \}}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00052\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{size\_t}\ Size\ =\ \textcolor{keyword}{sizeof}...(Rest);}
\DoxyCodeLine{00054\ \ \ \ \ ThisType\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Value;}
\DoxyCodeLine{00055\ \};}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{template}<>}
\DoxyCodeLine{00058\ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_any}{Any}}<>\ \{\ \};}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00060\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//ANY\_H}}
\end{DoxyCode}