\hypertarget{containers_8h_source}{}\doxysection{containers.\+h}
\label{containers_8h_source}\index{kblib/containers.h@{kblib/containers.h}}
\mbox{\hyperlink{containers_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00001}00001 \textcolor{comment}{/* *****************************************************************************}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00002}00002 \textcolor{comment}{ * kblib is a general utility library for C++14 and C++17, intended to provide}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00003}00003 \textcolor{comment}{ * performant high-\/level abstractions and more expressive ways to do simple}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00004}00004 \textcolor{comment}{ * things.}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2021 killerbee}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00008}00008 \textcolor{comment}{ * This program is free software: you can redistribute it and/or modify}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00009}00009 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00010}00010 \textcolor{comment}{ * the Free Software Foundation, either version 3 of the License, or}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00011}00011 \textcolor{comment}{ * (at your option) any later version.}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00013}00013 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00014}00014 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00015}00015 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00016}00016 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00017}00017 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00018}00018 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00019}00019 \textcolor{comment}{ * along with this program. If not, see .}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00020}00020 \textcolor{comment}{ * ****************************************************************************/}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00021}00021 }
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00031}00031 \textcolor{preprocessor}{\#ifndef KBLIB\_CONTAINERS\_H}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00032}00032 \textcolor{preprocessor}{\#define KBLIB\_CONTAINERS\_H}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00034}00034 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{fakestd_8h}{fakestd.h}}"{}}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00035}00035 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{iterators_8h}{iterators.h}}"{}}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00036}00036 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{tdecl_8h}{tdecl.h}}"{}}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00037}00037 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{traits_8h}{traits.h}}"{}}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00038}00038 }
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00039}00039 \textcolor{preprocessor}{\#include }}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00040}00040 \textcolor{preprocessor}{\#include }}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00041}00041 \textcolor{preprocessor}{\#include }}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00042}00042 \textcolor{preprocessor}{\#include }}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00043}00043 \textcolor{preprocessor}{\#include }}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00044}00044 \textcolor{preprocessor}{\#include }}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00045}00045 \textcolor{preprocessor}{\#include }}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00046}00046 }
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00047}00047 \textcolor{keyword}{namespace }\mbox{\hyperlink{tdecl_8h_a4b5c574c663a392148218cd4410fd7a1}{KBLIB\_NS}} \{}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00049}00049 \textcolor{keyword}{template} <\textcolor{keyword}{typename} C>}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00050}\mbox{\hyperlink{namespacekblib_ad505bc6a8318d39ac08f85bf9a8cddbb}{00050}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ad505bc6a8318d39ac08f85bf9a8cddbb}{pop}}(C\& s) -\/> \textcolor{keyword}{typename} C::value\_type \{}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00051}00051 \textcolor{keyword}{typename} C::value\_type ret = std::move(s.top());}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00052}00052 s.pop();}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00053}00053 \textcolor{keywordflow}{return} ret;}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00054}00054 \}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00056}00056 \textcolor{keyword}{template} <\textcolor{keyword}{class} C, \textcolor{keyword}{typename} K, \textcolor{keyword}{typename} V>}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00057}\mbox{\hyperlink{namespacekblib_a255d018d13394a47c014b2929a35a3b5}{00057}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_a255d018d13394a47c014b2929a35a3b5}{get\_or}}(\textcolor{keyword}{const} C\& m, \textcolor{keyword}{const} K\& key, \textcolor{keyword}{const} V\& defval)}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00058}00058 -\/> \textcolor{keyword}{typename} C::mapped\_type \{}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00059}00059 \textcolor{keyword}{auto} it = m.find(key);}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00060}00060 \textcolor{keywordflow}{if} (it == m.end())}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00061}00061 \textcolor{keywordflow}{return} defval;}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00062}00062 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00063}00063 \textcolor{keywordflow}{return} it-\/>second;}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00064}00064 \}}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00065}00065 }
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00066}00066 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Map, \textcolor{keyword}{typename} Key>}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00067}\mbox{\hyperlink{namespacekblib_ac2b7bd4d50cea42484b9824a8140602f}{00067}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{namespacekblib_ac2b7bd4d50cea42484b9824a8140602f}{try\_get}}(Map\& \mbox{\hyperlink{namespacekblib_a1490492d82c28f195f0f44a9d88fb2cc}{map}}, Key\&\& key)}
\DoxyCodeLine{\Hypertarget{containers_8h_source_l00068}00068 -\/> \mbox{\hyperlink{namespacekblib_af973fdd9c2dddf6db3744ae83902fc72}{copy\_const\_t