\doxysection{any.\+h}
\hypertarget{any_8h_source}{}\label{any_8h_source}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00002\ \textcolor{comment}{//\ \ open-\/cpp-\/utils,\ an\ open-\/source\ cpp\ library\ with\ data\ structures\ that\ extend\ the\ STL.}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ \ Copyright\ (C)\ 2024\ \ Medusa\ Slockbower}}
\DoxyCodeLine{00004\ \textcolor{comment}{//}}
\DoxyCodeLine{00005\ \textcolor{comment}{//\ \ This\ program\ is\ free\ software:\ you\ can\ redistribute\ it\ and/or\ modify}}
\DoxyCodeLine{00006\ \textcolor{comment}{//\ \ it\ under\ the\ terms\ of\ the\ GNU\ General\ Public\ License\ as\ published\ by}}
\DoxyCodeLine{00007\ \textcolor{comment}{//\ \ the\ Free\ Software\ Foundation,\ either\ version\ 3\ of\ the\ License,\ or}}
\DoxyCodeLine{00008\ \textcolor{comment}{//\ \ (at\ your\ option)\ any\ later\ version.}}
\DoxyCodeLine{00009\ \textcolor{comment}{//}}
\DoxyCodeLine{00010\ \textcolor{comment}{//\ \ This\ program\ is\ distributed\ in\ the\ hope\ that\ it\ will\ be\ useful,}}
\DoxyCodeLine{00011\ \textcolor{comment}{//\ \ but\ WITHOUT\ ANY\ WARRANTY;\ without\ even\ the\ implied\ warranty\ of}}
\DoxyCodeLine{00012\ \textcolor{comment}{//\ \ MERCHANTABILITY\ or\ FITNESS\ FOR\ A\ PARTICULAR\ PURPOSE.\ \ See\ the}}
\DoxyCodeLine{00013\ \textcolor{comment}{//\ \ GNU\ General\ Public\ License\ for\ more\ details.}}
\DoxyCodeLine{00014\ \textcolor{comment}{//}}
\DoxyCodeLine{00015\ \textcolor{comment}{//\ \ You\ should\ have\ received\ a\ copy\ of\ the\ GNU\ General\ Public\ License}}
\DoxyCodeLine{00016\ \textcolor{comment}{//\ \ along\ with\ this\ program.\ \ If\ not,\ see\ <https://www.gnu.org/licenses/>.}}
\DoxyCodeLine{00017\ \textcolor{comment}{//\ =====================================================================================================================}}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#ifndef\ OPEN\_CPP\_UTILS\_ANY\_H}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#define\ OPEN\_CPP\_UTILS\_ANY\_H}}
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{template__utils_8h}{template\_utils.h}}"{}}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{keyword}{namespace\ }open\_cpp\_utils}
\DoxyCodeLine{00025\ \{}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}...Ts>\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}};}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \textcolor{keyword}{template}<>\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}<>\ \{\ \};}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}...Rest>}
\DoxyCodeLine{00036\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}<T,\ Rest...>\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}<Rest...>}
\DoxyCodeLine{00037\ \{}
\DoxyCodeLine{00038\ \textcolor{comment}{//\ Assertions\ ==========================================================================================================}}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keyword}{static\_assert}(is\_unique<T,\ Rest...>);}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \textcolor{comment}{//\ Typedefs\ ============================================================================================================}}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keyword}{using\ }\mbox{\hyperlink{classopen__cpp__utils_1_1any}{base\_type}}\ =\ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}<Rest...>;}
\DoxyCodeLine{00047\ }
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keyword}{using\ }this\_type\ \ \ \ \ \ \ =\ T;}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keyword}{using\ }reference\ \ \ \ \ \ \ =\ T\&;}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keyword}{using\ }const\_reference\ =\ \textcolor{keyword}{const}\ T\&;}
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keyword}{using\ }pointer\ \ \ \ \ \ \ \ \ =\ T*;}
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keyword}{using\ }const\_pointer\ \ \ =\ \textcolor{keyword}{const}\ T*;}
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00055\ \textcolor{comment}{//\ Constructors\ ========================================================================================================}}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00058\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}()\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{base\_type}}()\ \ \ \ \ \ \ \ ,\ Value()\ \{\ \}}
\DoxyCodeLine{00059\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}(\textcolor{keyword}{const}\ this\_type\&\ value,\ \textcolor{keyword}{const}\ Rest\&...other)\ :\ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{base\_type}}(other...),\ Value(value)\ \{\ \}}
\DoxyCodeLine{00060\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}(this\_type\&\&\ value,\ Rest\&\&...other)\ \ \ \ \ \ \ \ \ \ \ :\ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{base\_type}}(other...),\ Value(value)\ \{\ \}}
\DoxyCodeLine{00061\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}\&\ other)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00062\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}(\mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}\&\&\ other)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00063\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{\string~any}}()\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00064\ }
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \textcolor{comment}{//\ Operators\ ===========================================================================================================}}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \textcolor{comment}{//\ Assignment\ operators\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00071\ }
\DoxyCodeLine{00072\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}\&\ operator=(\textcolor{keyword}{const}\ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}\&)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00073\ \ \ \ \ \mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}\&\ operator=(\mbox{\hyperlink{classopen__cpp__utils_1_1any}{any}}\&\&)\ \ \ \ \ \ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00076\ \textcolor{comment}{//\ Access\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ V>}
\DoxyCodeLine{00079\ \ \ \ \ V\&\ get()}
\DoxyCodeLine{00080\ \ \ \ \ \{}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static\_assert}(std::disjunction<std::is\_same<V,\ T>,\ std::is\_same<V,\ Rest>...>\{\});}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}V\&\textcolor{keyword}{>}(*this);}
\DoxyCodeLine{00083\ \ \ \ \ \}}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ V>}
\DoxyCodeLine{00086\ \ \ \ \ \textcolor{keyword}{const}\ V\&\ get()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00087\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{00088\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static\_assert}(std::disjunction<std::is\_same<V,\ T>,\ std::is\_same<V,\ Rest>...>\{\});}
\DoxyCodeLine{00089\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}\textcolor{keyword}{const\ }V\&\textcolor{keyword}{>}(*this);}
\DoxyCodeLine{00090\ \ \ \ \ \}}
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{comment}{//\ Cast\ operators\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \ \ \ \ \textcolor{keyword}{operator}\ \ \ \ \ \ \ reference()\ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ \ Value;\ \}}
\DoxyCodeLine{00095\ \ \ \ \ \textcolor{keyword}{operator}\ const\_reference()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \ Value;\ \}}
\DoxyCodeLine{00096\ \ \ \ \ \textcolor{keyword}{operator}\ \ \ \ \ \ \ \ \ pointer()\ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ \&Value;\ \}}
\DoxyCodeLine{00097\ \ \ \ \ \textcolor{keyword}{operator}\ \ \ const\_pointer()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \&Value;\ \}}
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \textcolor{comment}{//\ Variables\ ===========================================================================================================}}
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00102\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{size\_t}\ Size\ =\ \textcolor{keyword}{sizeof}...(Rest);}
\DoxyCodeLine{00104\ \ \ \ \ this\_type\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Value;}
\DoxyCodeLine{00105\ \};}
\DoxyCodeLine{00106\ }
\DoxyCodeLine{00107\ \}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ OPEN\_CPP\_UTILS\_ANY\_H}}

\end{DoxyCode}
