\hypertarget{intrusive__containers_8h_source}{}\doxysection{intrusive\+\_\+containers.\+h} \label{intrusive__containers_8h_source}\index{kblib/intrusive\_containers.h@{kblib/intrusive\_containers.h}} \mbox{\hyperlink{intrusive__containers_8h}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00001}00001 \textcolor{comment}{/* *****************************************************************************}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00002}00002 \textcolor{comment}{ * kblib is a general utility library for C++14 and C++17, intended to provide}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00003}00003 \textcolor{comment}{ * performant high-\/level abstractions and more expressive ways to do simple}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00004}00004 \textcolor{comment}{ * things.}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00005}00005 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2021 killerbee}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00007}00007 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00008}00008 \textcolor{comment}{ * This program is free software: you can redistribute it and/or modify}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00009}00009 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00010}00010 \textcolor{comment}{ * the Free Software Foundation, either version 3 of the License, or}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00011}00011 \textcolor{comment}{ * (at your option) any later version.}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00012}00012 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00013}00013 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00014}00014 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00015}00015 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00016}00016 \textcolor{comment}{ * GNU General Public License for more details.}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00017}00017 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00018}00018 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00019}00019 \textcolor{comment}{ * along with this program. If not, see .}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00020}00020 \textcolor{comment}{ * ****************************************************************************/}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00021}00021 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00032}00032 \textcolor{preprocessor}{\#ifndef INTRUSIVE\_CONTAINERS\_H}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00033}00033 \textcolor{preprocessor}{\#define INTRUSIVE\_CONTAINERS\_H}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00034}00034 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00035}00035 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{hash_8h}{hash.h}}"{}}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00036}00036 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{traits_8h}{traits.h}}"{}}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00037}00037 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00038}00038 \textcolor{preprocessor}{\#include }} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00039}00039 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00040}00040 \textcolor{keyword}{namespace }\mbox{\hyperlink{tdecl_8h_a4b5c574c663a392148218cd4410fd7a1}{KBLIB\_NS}} \{} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00041}00041 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00042}00042 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00043}00043 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00044}00044 \textcolor{keyword}{template} <\textcolor{keyword}{typename} Value, auto KeyExtract, \textcolor{keyword}{typename} Hash = kblib::FNV\_hash<>,} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00045}00045 \textcolor{keyword}{typename} KeyEqual = std::equal\_to<>>} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00046}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map}{00046}} \textcolor{keyword}{class }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map}{intrusive\_hash\_map}} \{} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00047}00047 \textcolor{keyword}{public}:} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00048}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af13d1b4078f7567221bcb25fdbe428ea}{00048}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af13d1b4078f7567221bcb25fdbe428ea}{value\_type}} = Value;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00049}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_aa39b6328f87c1231ab1ce8df894bc1a3}{00049}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_aa39b6328f87c1231ab1ce8df894bc1a3}{key\_type}}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00050}00050 = \mbox{\hyperlink{namespacekblib_ad3067cf43d6c4d6d61e9bbb81c145cf9}{remove\_cvref\_t}}<\mbox{\hyperlink{namespacekblib_1_1fakestd_a2641177fb1c17f887061308f2b8b6cae}{std::invoke\_result\_t}}<\textcolor{keyword}{decltype}(KeyExtract), Value\&>>;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00051}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a6421a8c3faf979700b37c0d8a4ec9ebb}{00051}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a6421a8c3faf979700b37c0d8a4ec9ebb}{mapped\_type}} = Value;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00052}00052 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00053}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a4fe9685255ea1348cc74ffd25ffe151e}{00053}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a4fe9685255ea1348cc74ffd25ffe151e}{size\_type}} = std::size\_t;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00054}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a0c9ee826fefd686f1678ce507895b050}{00054}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a0c9ee826fefd686f1678ce507895b050}{difference\_type}} = std::ptrdiff\_t;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00055}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a9976c914e777ca1cc9739e1f79daf738}{00055}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a9976c914e777ca1cc9739e1f79daf738}{hasher}} = Hash;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00056}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a70685192419c95a969dda4ad4b932dce}{00056}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a70685192419c95a969dda4ad4b932dce}{key\_equal}} = KeyEqual;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00057}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_ae82c79afa070ca70f20231a7f629d708}{00057}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_ae82c79afa070ca70f20231a7f629d708}{allocator\_type}} = void;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00058}00058 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00059}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a1fba29ce11575fbbffb1ee59395ee9db}{00059}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a1fba29ce11575fbbffb1ee59395ee9db}{reference}} = \mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af13d1b4078f7567221bcb25fdbe428ea}{value\_type}}\&;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00060}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a9998f923dcedc94ddbb9a5ffe188b066}{00060}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a9998f923dcedc94ddbb9a5ffe188b066}{const\_reference}} = \textcolor{keyword}{const} \mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af13d1b4078f7567221bcb25fdbe428ea}{value\_type}}\&;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00061}00061 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00062}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a29d34d09ce1f78ae47186afab30a5774}{00062}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a29d34d09ce1f78ae47186afab30a5774}{pointer}} = \mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af13d1b4078f7567221bcb25fdbe428ea}{value\_type}}*;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00063}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_ada9200fdd09ff7e84c37ff2107810fe7}{00063}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_ada9200fdd09ff7e84c37ff2107810fe7}{const\_pointer}} = \textcolor{keyword}{const} \mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af13d1b4078f7567221bcb25fdbe428ea}{value\_type}}*;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00064}00064 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00065}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af9b57c4e7435dc9588e9afdc5c7c57de}{00065}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af9b57c4e7435dc9588e9afdc5c7c57de}{iterator}} = void;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00066}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af5b7b85e202f15fd9cb263a059b073a8}{00066}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_af5b7b85e202f15fd9cb263a059b073a8}{const\_iterator}} = void;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00067}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a13afa6b75e6cea658d91ef06cccc1ce8}{00067}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a13afa6b75e6cea658d91ef06cccc1ce8}{local\_iterator}} = void;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00068}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a273b0f26b976d6cdd55401702a31591c}{00068}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_a273b0f26b976d6cdd55401702a31591c}{const\_local\_iterator}} = void;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00069}00069 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00070}00070 \textcolor{comment}{// etc}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00071}00071 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00072}00072 \textcolor{keyword}{template} <\textcolor{keywordtype}{int}>} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00073}\mbox{\hyperlink{classkblib_1_1intrusive__hash__map_ad52dd4e1b9bd690bf1ce75e16a90cc4e}{00073}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1intrusive__hash__map_ad52dd4e1b9bd690bf1ce75e16a90cc4e}{get}}() -\/> \textcolor{keyword}{auto};} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00074}00074 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00075}00075 \textcolor{keyword}{private}:} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00076}00076 std::deque storage;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00077}00077 \textcolor{keywordtype}{double} load\_factor;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00078}00078 \};} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00079}00079 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00080}00080 \textcolor{keyword}{template} <} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00081}00081 \textcolor{keyword}{typename} Value, \textcolor{keyword}{auto} KeyExtract1, \textcolor{keyword}{auto} KeyExtract2,} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00082}00082 \textcolor{keyword}{typename} Hash1 = \mbox{\hyperlink{structkblib_1_1_f_n_v__hash}{kblib::FNV\_hash<>}}, \textcolor{keyword}{typename} Hash2 = \mbox{\hyperlink{structkblib_1_1_f_n_v__hash}{kblib::FNV\_hash<>}},} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00083}00083 \textcolor{keyword}{typename} KeyEqual1 = std::equal\_to<>, \textcolor{keyword}{typename} KeyEqual2 = std::equal\_to<>>} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00084}\mbox{\hyperlink{classkblib_1_1intrusive__dual__map}{00084}} \textcolor{keyword}{class }\mbox{\hyperlink{classkblib_1_1intrusive__dual__map}{intrusive\_dual\_map}} \{} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00085}00085 \textcolor{keyword}{public}:} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00086}\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a3f548656c4b13e3e2ce5a4133acd220c}{00086}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a3f548656c4b13e3e2ce5a4133acd220c}{value\_type}} = Value;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00087}\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a48fb548313723e299fb54c58860171b1}{00087}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a48fb548313723e299fb54c58860171b1}{key\_type\_a}}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00088}00088 = \mbox{\hyperlink{namespacekblib_ad3067cf43d6c4d6d61e9bbb81c145cf9}{remove\_cvref\_t}}<\mbox{\hyperlink{namespacekblib_1_1fakestd_a2641177fb1c17f887061308f2b8b6cae}{std::invoke\_result\_t}}<\textcolor{keyword}{decltype}(KeyExtract1), Value\&>>;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00089}\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a21427ef662b1665f341363d4cbcdbc7e}{00089}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a21427ef662b1665f341363d4cbcdbc7e}{key\_type\_b}}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00090}00090 = \mbox{\hyperlink{namespacekblib_ad3067cf43d6c4d6d61e9bbb81c145cf9}{remove\_cvref\_t}}<\mbox{\hyperlink{namespacekblib_1_1fakestd_a2641177fb1c17f887061308f2b8b6cae}{std::invoke\_result\_t}}<\textcolor{keyword}{decltype}(KeyExtract2), Value\&>>;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00091}\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a4c23de6087c7ee3316905fc66948cc59}{00091}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_a4c23de6087c7ee3316905fc66948cc59}{mapped\_type}} = Value;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00092}00092 \textcolor{comment}{// etc}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00093}00093 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00094}00094 \textcolor{keyword}{template} <\textcolor{keywordtype}{int}>} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00095}\mbox{\hyperlink{classkblib_1_1intrusive__dual__map_acc37b8b57a1b9b62e6a1159e98220e21}{00095}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1intrusive__dual__map_acc37b8b57a1b9b62e6a1159e98220e21}{get}}() -\/> \textcolor{keyword}{auto};} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00096}00096 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00097}00097 \textcolor{keyword}{private}:} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00098}00098 std::deque storage;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00099}00099 std::unordered\_map map\_a;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00100}00100 std::unordered\_map map\_b;} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00101}00101 \};} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00102}00102 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00103}00103 \textcolor{preprocessor}{\#endif}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00104}00104 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00105}00105 \} \textcolor{comment}{// namespace KBLIB\_NS}} \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00106}00106 } \DoxyCodeLine{\Hypertarget{intrusive__containers_8h_source_l00107}00107 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// INTRUSIVE\_CONTAINERS\_H}} \end{DoxyCode}