\hypertarget{delayed__construct_8h_source}{}\doxysection{delayed\+\_\+construct.\+h} \label{delayed__construct_8h_source}\index{kblib/delayed\_construct.h@{kblib/delayed\_construct.h}} \mbox{\hyperlink{delayed__construct_8h}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00001}00001 \textcolor{comment}{/* *****************************************************************************}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00002}00002 \textcolor{comment}{ * kblib is a general utility library for C++14 and C++17, intended to provide}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00003}00003 \textcolor{comment}{ * performant high-\/level abstractions and more expressive ways to do simple}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00004}00004 \textcolor{comment}{ * things.}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00005}00005 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2021 killerbee}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00007}00007 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00008}00008 \textcolor{comment}{ * This program is free software: you can redistribute it and/or modify}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00009}00009 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00010}00010 \textcolor{comment}{ * the Free Software Foundation, either version 3 of the License, or}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00011}00011 \textcolor{comment}{ * (at your option) any later version.}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00012}00012 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00013}00013 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00014}00014 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00015}00015 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00016}00016 \textcolor{comment}{ * GNU General Public License for more details.}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00017}00017 \textcolor{comment}{ *}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00018}00018 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00019}00019 \textcolor{comment}{ * along with this program. If not, see .}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00020}00020 \textcolor{comment}{ * ****************************************************************************/}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00021}00021 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00032}00032 \textcolor{preprocessor}{\#ifndef DELAYED\_CONSTRUCT\_H}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00033}00033 \textcolor{preprocessor}{\#define DELAYED\_CONSTRUCT\_H}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00034}00034 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00035}00035 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{hash_8h}{hash.h}}"{}}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00036}00036 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{tdecl_8h}{tdecl.h}}"{}}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00037}00037 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00038}00038 \textcolor{preprocessor}{\#if KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00039}00039 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00040}00040 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00041}00041 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00042}00042 \textcolor{preprocessor}{\# if KBLIB\_USE\_CXX20}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00043}00043 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00044}00044 \textcolor{preprocessor}{\# include }} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00045}00045 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00046}00046 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00047}00047 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00048}00048 \textcolor{keyword}{namespace }\mbox{\hyperlink{tdecl_8h_a4b5c574c663a392148218cd4410fd7a1}{KBLIB\_NS}} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00049}00049 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00050}00050 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00051}\mbox{\hyperlink{classkblib_1_1delayed__construct}{00051}} \textcolor{keyword}{class }\mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00052}00052 \textcolor{keyword}{private}:} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00053}00053 \textcolor{keyword}{using }Base = std::optional;} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00054}00054 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00055}00055 \textcolor{keyword}{protected}:} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00056}\mbox{\hyperlink{classkblib_1_1delayed__construct_ad1b10f3376c84b0d4b4c522b989bf805}{00056}} Base \mbox{\hyperlink{classkblib_1_1delayed__construct_ad1b10f3376c84b0d4b4c522b989bf805}{storage}};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00057}00057 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00058}00058 \textcolor{keyword}{public}:} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00059}00059 \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00060}00060 \mbox{\hyperlink{tdecl_8h_a9bae2bd5888633dceb4571b7e14f8b12}{KBLIB\_CXX20}}(\textcolor{keyword}{requires}(std::constructible\_from))} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00061}\mbox{\hyperlink{classkblib_1_1delayed__construct_adf4f7cba3e517f36bb8b2e4bb3578bb9}{00061}} \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}(Ts\&\&... args)} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00062}00062 : storage(\mbox{\hyperlink{namespacestd}{std}}::forward(args)...) \{\}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00063}00063 \textcolor{keyword}{template} <\textcolor{keyword}{typename} U,} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00064}00064 std::enable\_if\_t, \textcolor{keywordtype}{int}> = 0>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00065}\mbox{\hyperlink{classkblib_1_1delayed__construct_a349dec9f96dd8e64439f306762c8e51b}{00065}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_a349dec9f96dd8e64439f306762c8e51b}{operator=}}(U\&\& t) -\/> \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\& \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00066}00066 storage = std::forward(t);} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00067}00067 \textcolor{keywordflow}{return} *\textcolor{keyword}{this};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00068}00068 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00069}\mbox{\hyperlink{classkblib_1_1delayed__construct_a68f80c2fca06241f85fd523c201c02d4}{00069}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_a68f80c2fca06241f85fd523c201c02d4}{operator=}}(std::nullopt\_t) -\/> \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\& = \textcolor{keyword}{delete};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00070}00070 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00071}00071 \textcolor{keyword}{template} <\textcolor{keyword}{typename}... Ts>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00072}\mbox{\hyperlink{classkblib_1_1delayed__construct_a09e024ba24c80a10473318c943567cf3}{00072}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_a09e024ba24c80a10473318c943567cf3}{emplace}}(Ts\&\&... args) \textcolor{keyword}{const} -\/> \textcolor{keyword}{decltype}(\textcolor{keyword}{auto}) \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00073}00073 \textcolor{keywordflow}{return} storage.emplace(std::forward(args)...);} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00074}00074 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00075}00075 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00076}\mbox{\hyperlink{classkblib_1_1delayed__construct_a85b0162c9b3c4a2e780b5e47aeff91b6}{00076}} \mbox{\hyperlink{classkblib_1_1delayed__construct_a85b0162c9b3c4a2e780b5e47aeff91b6}{delayed\_construct}}(\textcolor{keyword}{const} \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\&) = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00077}\mbox{\hyperlink{classkblib_1_1delayed__construct_a7deba00bc60d54a833e4df71923a32b4}{00077}} \mbox{\hyperlink{classkblib_1_1delayed__construct_a7deba00bc60d54a833e4df71923a32b4}{delayed\_construct}}(\mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\&\&) = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00078}\mbox{\hyperlink{classkblib_1_1delayed__construct_ad6b687dadc4da0a7cd2fde64448adf41}{00078}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_ad6b687dadc4da0a7cd2fde64448adf41}{operator=}}(\textcolor{keyword}{const} \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\&) -\/> \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\& = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00079}\mbox{\hyperlink{classkblib_1_1delayed__construct_a818d4c7021a681773004f3a53a6fb1ac}{00079}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_a818d4c7021a681773004f3a53a6fb1ac}{operator=}}(\mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\&\&) -\/> \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\& = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00080}\mbox{\hyperlink{classkblib_1_1delayed__construct_a24842b14d7320cd056252dc2e8c2ca4d}{00080}} \mbox{\hyperlink{classkblib_1_1delayed__construct_a24842b14d7320cd056252dc2e8c2ca4d}{\string~delayed\_construct}}() = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00081}00081 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00082}\mbox{\hyperlink{classkblib_1_1delayed__construct_aed02967dfd141efba9582da68a8df83d}{00082}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_aed02967dfd141efba9582da68a8df83d}{operator-\/>}}() const -\/> decltype(auto) \{ \textcolor{keywordflow}{return} storage.operator-\/>(); \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00083}\mbox{\hyperlink{classkblib_1_1delayed__construct_afdb6a3d036389cf9092fe87caf585f10}{00083}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_afdb6a3d036389cf9092fe87caf585f10}{operator*}}() const -\/> decltype(auto) \{ \textcolor{keywordflow}{return} storage.operator*(); \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00084}\mbox{\hyperlink{classkblib_1_1delayed__construct_a32eb86e7b80f5aeb6c8218c6c4449cec}{00084}} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_a32eb86e7b80f5aeb6c8218c6c4449cec}{value}}() const -\/> decltype(auto) \{ \textcolor{keywordflow}{return} storage.value(); \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00085}\mbox{\hyperlink{classkblib_1_1delayed__construct_ab2f42a32387a3e80852a115c87a297a1}{00085}} \textcolor{keyword}{explicit} \textcolor{keyword}{operator} bool()\textcolor{keyword}{ const }\{ \textcolor{keywordflow}{return} \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{bool}\textcolor{keyword}{>}(storage); \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00086}\mbox{\hyperlink{classkblib_1_1delayed__construct_a760c2ebaa9dc34afe11bba1ea4d09843}{00086}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} \textcolor{keyword}{auto} \mbox{\hyperlink{classkblib_1_1delayed__construct_a760c2ebaa9dc34afe11bba1ea4d09843}{is\_constructed}}() const noexcept -\/> \textcolor{keywordtype}{bool} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00087}00087 \textcolor{keywordflow}{return} storage.has\_value();} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00088}00088 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00089}00089 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00090}00090 \textcolor{comment}{// TODO(killerbee13): add C++20 operator<=> support to delayed\_construct}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00091}00091 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00092}00092 \textcolor{preprocessor}{\# if 0}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00093}00093 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00094}00094 \textcolor{keyword}{template} U>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00095}00095 \textcolor{keyword}{requires}(not std::same\_as) \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00096}00096 operator<=>(\textcolor{keyword}{const} U\& other) \textcolor{keyword}{const} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00097}00097 \textcolor{keywordflow}{return} storage <=> other;} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00098}00098 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00099}00099 \textcolor{keyword}{template} U>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00100}00100 \textcolor{keyword}{requires}(not std::same\_as) \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00101}00101 \textcolor{keyword}{operator}==(\textcolor{keyword}{const} U\& other) \textcolor{keyword}{const} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00102}00102 \textcolor{keywordflow}{return} storage == other;} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00103}00103 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00104}00104 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} operator<=>(} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00105}00105 \textcolor{keyword}{const} delayed\_construct\& other) \textcolor{keyword}{const} = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00106}00106 \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{auto} operator==(\textcolor{keyword}{const} delayed\_construct\& other) \textcolor{keyword}{const} -\/> \textcolor{keywordtype}{bool}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00107}00107 = \textcolor{keywordflow}{default};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00108}00108 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00109}00109 \textcolor{preprocessor}{\# else}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00110}00110 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00111}\mbox{\hyperlink{delayed__construct_8h_a57a6a2987085086b2c677388f996437b}{00111}} \textcolor{preprocessor}{\# define OVERLOAD\_DEFER\_OP(op) \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00112}00112 \textcolor{preprocessor}{ KBLIB\_NODISCARD friend constexpr auto operator op( \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00113}00113 \textcolor{preprocessor}{ const delayed\_construct\& lhs, \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00114}00114 \textcolor{preprocessor}{ const delayed\_construct\& rhs) noexcept-\/>bool \{ \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00115}00115 \textcolor{preprocessor}{ return lhs.storage op rhs.storage; \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00116}00116 \textcolor{preprocessor}{ \} \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00117}00117 \textcolor{preprocessor}{ template \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00118}00118 \textcolor{preprocessor}{ KBLIB\_NODISCARD friend constexpr auto operator op( \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00119}00119 \textcolor{preprocessor}{ const delayed\_construct\& lhs, \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00120}00120 \textcolor{preprocessor}{ const delayed\_construct\& rhs) noexcept-\/>bool \{ \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00121}00121 \textcolor{preprocessor}{ return lhs.storage op static\_cast\&>(rhs); \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00122}00122 \textcolor{preprocessor}{ \} \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00123}00123 \textcolor{preprocessor}{ KBLIB\_NODISCARD friend constexpr auto operator op( \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00124}00124 \textcolor{preprocessor}{ const delayed\_construct\& lhs, \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00125}00125 \textcolor{preprocessor}{ std::nullopt\_t rhs) noexcept-\/>bool \{ \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00126}00126 \textcolor{preprocessor}{ return lhs.storage op rhs; \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00127}00127 \textcolor{preprocessor}{ \} \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00128}00128 \textcolor{preprocessor}{ KBLIB\_NODISCARD friend constexpr auto operator op( \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00129}00129 \textcolor{preprocessor}{ std::nullopt\_t lhs, \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00130}00130 \textcolor{preprocessor}{ const delayed\_construct\& rhs) noexcept-\/>bool \{ \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00131}00131 \textcolor{preprocessor}{ return lhs op rhs.storage; \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00132}00132 \textcolor{preprocessor}{ \} \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00133}00133 \textcolor{preprocessor}{ template \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00134}00134 \textcolor{preprocessor}{ KBLIB\_NODISCARD friend constexpr auto operator op( \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00135}00135 \textcolor{preprocessor}{ const delayed\_construct\& opt, const U\& value) noexcept-\/>bool \{ \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00136}00136 \textcolor{preprocessor}{ return opt.storage op value; \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00137}00137 \textcolor{preprocessor}{ \} \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00138}00138 \textcolor{preprocessor}{ template \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00139}00139 \textcolor{preprocessor}{ KBLIB\_NODISCARD friend constexpr auto operator op( \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00140}00140 \textcolor{preprocessor}{ const U\& value, const delayed\_construct\& opt) noexcept-\/>bool \{ \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00141}00141 \textcolor{preprocessor}{ return value op opt.storage; \(\backslash\)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00142}00142 \textcolor{preprocessor}{ \}}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00143}00143 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00152}\mbox{\hyperlink{classkblib_1_1delayed__construct_a5150b83d88f49dbf0cd08eafb5c94507}{00152}} \mbox{\hyperlink{delayed__construct_8h_a57a6a2987085086b2c677388f996437b}{OVERLOAD\_DEFER\_OP}}(==)} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00153}\mbox{\hyperlink{classkblib_1_1delayed__construct_ab86fed8ac314a62576c5633a36bb69cd}{00153}} \mbox{\hyperlink{delayed__construct_8h_a57a6a2987085086b2c677388f996437b}{OVERLOAD\_DEFER\_OP}}(!=)} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00155}00155 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00163}\mbox{\hyperlink{classkblib_1_1delayed__construct_a22e41a5a093d97d12f80722ff4a87cdc}{00163}} \mbox{\hyperlink{delayed__construct_8h_a57a6a2987085086b2c677388f996437b}{OVERLOAD\_DEFER\_OP}}(<)} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00164}\mbox{\hyperlink{classkblib_1_1delayed__construct_a1caa57b1eed3facf6fb76c94c8f0f582}{00164}} \mbox{\hyperlink{delayed__construct_8h_a57a6a2987085086b2c677388f996437b}{OVERLOAD\_DEFER\_OP}}(<=)} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00165}\mbox{\hyperlink{classkblib_1_1delayed__construct_aceeccd316c5d47edb07f02bebd8e4c54}{00165}} \mbox{\hyperlink{delayed__construct_8h_a57a6a2987085086b2c677388f996437b}{OVERLOAD\_DEFER\_OP}}(>)} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00166}\mbox{\hyperlink{classkblib_1_1delayed__construct_a4f6093f2e668b39ece754164fa8e2f5e}{00166}} \mbox{\hyperlink{delayed__construct_8h_a57a6a2987085086b2c677388f996437b}{OVERLOAD\_DEFER\_OP}}(>=)} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00168}00168 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00169}00169 \textcolor{preprocessor}{\# undef OVERLOAD\_DEFER\_OP}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00170}00170 \textcolor{preprocessor}{\# endif}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00171}00171 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00172}00172 \textcolor{keyword}{friend} \textcolor{keyword}{struct }std::hash<\mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}>;} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00173}00173 \textcolor{keyword}{friend} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1_f_n_v__hash}{FNV\_hash}}<\mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}>;} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00174}00174 \};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00175}00175 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00176}00176 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00177}\mbox{\hyperlink{structkblib_1_1_f_n_v__hash_3_01delayed__construct_3_01_t_01_4_00_01void_01_4}{00177}} \textcolor{keyword}{struct }\mbox{\hyperlink{structkblib_1_1_f_n_v__hash}{FNV\_hash}}<\mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}, void> \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00178}\mbox{\hyperlink{structkblib_1_1_f_n_v__hash_3_01delayed__construct_3_01_t_01_4_00_01void_01_4_aeee7d8448f183e00454465f185dba85a}{00178}} \mbox{\hyperlink{tdecl_8h_a7f62d0731631a0e7675f45924b7f5ea0}{KBLIB\_NODISCARD}} \textcolor{keyword}{constexpr} std::size\_t \mbox{\hyperlink{structkblib_1_1_f_n_v__hash_3_01delayed__construct_3_01_t_01_4_00_01void_01_4_aeee7d8448f183e00454465f185dba85a}{operator()}}(} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00179}00179 \textcolor{keyword}{const} \mbox{\hyperlink{classkblib_1_1delayed__construct}{delayed\_construct}}\& key,} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00180}00180 std::size\_t offset} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00181}00181 = \mbox{\hyperlink{structkblib_1_1fnv_1_1fnv__offset}{fnv::fnv\_offset::value}}) \textcolor{keyword}{const} \textcolor{keyword}{noexcept} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00182}00182 \textcolor{keywordflow}{if} (key) \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00183}00183 \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1_f_n_v__hash}{FNV\_hash}}\{\}(key.value(), offset);} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00184}00184 \} \textcolor{keywordflow}{else} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00185}00185 \textcolor{keywordflow}{return} \mbox{\hyperlink{structkblib_1_1_f_n_v__hash}{FNV\_hash}}\{\}(std::nullopt, offset);} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00186}00186 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00187}00187 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00188}00188 \};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00189}00189 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00190}00190 \} \textcolor{comment}{// namespace KBLIB\_NS}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00191}00191 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00192}00192 \textcolor{keyword}{namespace }\mbox{\hyperlink{namespacestd}{std}} \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00193}00193 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00194}00194 \textcolor{comment}{// Inheriting from another hash specialization means that this hash is (mostly)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00195}00195 \textcolor{comment}{// disabled when std::hash is (if I read the requirements correctly,}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00196}00196 \textcolor{comment}{// operator() should not be declared in a disabled std::hash, but I basically}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00197}00197 \textcolor{comment}{// can't do that in any sensible way)}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00198}00198 \textcolor{keyword}{template} <\textcolor{keyword}{typename} T>} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00199}\mbox{\hyperlink{structstd_1_1hash_3_01kblib_1_1delayed__construct_3_01_t_01_4_01_4}{00199}} \textcolor{keyword}{struct }hash<\mbox{\hyperlink{namespacekblib}{kblib}}::delayed\_construct> : hash \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00200}\mbox{\hyperlink{structstd_1_1hash_3_01kblib_1_1delayed__construct_3_01_t_01_4_01_4_a9593595be90735b53ec97850dfdc77bc}{00200}} \textcolor{keyword}{using }\mbox{\hyperlink{classkblib_1_1delayed__construct}{argument\_type}} = \mbox{\hyperlink{classkblib_1_1delayed__construct}{kblib::delayed\_construct}};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00201}\mbox{\hyperlink{structstd_1_1hash_3_01kblib_1_1delayed__construct_3_01_t_01_4_01_4_a572d433bce5f2b3b6c1ebfcc884ffb45}{00201}} \textcolor{keyword}{auto} \mbox{\hyperlink{structstd_1_1hash_3_01kblib_1_1delayed__construct_3_01_t_01_4_01_4_a572d433bce5f2b3b6c1ebfcc884ffb45}{operator()}}(\textcolor{keyword}{const} \mbox{\hyperlink{classkblib_1_1delayed__construct}{argument\_type}}\& value) \textcolor{keyword}{const} \textcolor{keyword}{noexcept} -\/> std::size\_t \{} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00202}00202 \textcolor{keywordflow}{return} hash>\{\}(\textcolor{keyword}{static\_cast<}\textcolor{keyword}{const }optional\&\textcolor{keyword}{>}(value));} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00203}00203 \}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00204}00204 \};} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00205}00205 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00206}00206 \} \textcolor{comment}{// namespace std}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00207}00207 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00208}00208 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// KBLIB\_USE\_CXX17}} \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00209}00209 } \DoxyCodeLine{\Hypertarget{delayed__construct_8h_source_l00210}00210 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// DELAYED\_CONSTRUCT\_H}} \end{DoxyCode}