\hypertarget{poly__obj_8h}{}\doxysection{kblib/poly\+\_\+obj.h File Reference}
\label{poly__obj_8h}\index{kblib/poly\_obj.h@{kblib/poly\_obj.h}}


Provides poly\+\_\+obj, which enables polymorphism to be used without unnecessary per-\/object dynamic allocations.  


{\ttfamily \#include \char`\"{}hash.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}variant.\+h\char`\"{}}\newline
Include dependency graph for poly\+\_\+obj.\+h\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{poly__obj_8h__incl}
\end{center}
\end{figure}
This graph shows which files directly or indirectly include this file\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{poly__obj_8h__dep__incl}
\end{center}
\end{figure}
\doxysubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1construct__conditional_3_01construct__type_1_1none_01_4}{kblib\+::detail\+\_\+poly\+::construct\+\_\+conditional$<$ construct\+\_\+type\+::none $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1construct__conditional_3_01construct__type_1_1copy__only_01_4}{kblib\+::detail\+\_\+poly\+::construct\+\_\+conditional$<$ construct\+\_\+type\+::copy\+\_\+only $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1construct__conditional_3_01construct__type_1_1move_01_4}{kblib\+::detail\+\_\+poly\+::construct\+\_\+conditional$<$ construct\+\_\+type\+::move $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1construct__conditional_3_01construct__type_1_1both_01_4}{kblib\+::detail\+\_\+poly\+::construct\+\_\+conditional$<$ construct\+\_\+type\+::both $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1construct__conditional_3_01construct__type_1_1throw__move_01_4}{kblib\+::detail\+\_\+poly\+::construct\+\_\+conditional$<$ construct\+\_\+type\+::throw\+\_\+move $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1construct__conditional_3_01construct__type_1_1both__throw_01_4}{kblib\+::detail\+\_\+poly\+::construct\+\_\+conditional$<$ construct\+\_\+type\+::both\+\_\+throw $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1erased__hash__t}{kblib\+::detail\+\_\+poly\+::erased\+\_\+hash\+\_\+t$<$ T, hash $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1erased__hash__t_3_01_t_00_01void__t_3_01fakestd_1_1invoke__resulte0f114b0d28ead89999e6027fb1e55a8}{kblib\+::detail\+\_\+poly\+::erased\+\_\+hash\+\_\+t$<$ T, void\+\_\+t$<$ fakestd\+::invoke\+\_\+result\+\_\+t$<$ std\+::hash$<$ T $>$, T $>$ $>$ $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1kblib__erased__hash__t}{kblib\+::detail\+\_\+poly\+::kblib\+\_\+erased\+\_\+hash\+\_\+t$<$ T, hash $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1kblib__erased__hash__t_3_01_t_00_01void__t_3_01fakestd_1_1invoke_55adc4f6ef833cf6a377ac3d9da5a8e3}{kblib\+::detail\+\_\+poly\+::kblib\+\_\+erased\+\_\+hash\+\_\+t$<$ T, void\+\_\+t$<$ fakestd\+::invoke\+\_\+result\+\_\+t$<$ std\+::hash$<$ T $>$, T $>$ $>$ $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1erased__construct}{kblib\+::detail\+\_\+poly\+::erased\+\_\+construct$<$ Traits $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1extract__derived__size}{kblib\+::detail\+\_\+poly\+::extract\+\_\+derived\+\_\+size$<$ T, typename $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1detail__poly_1_1extract__derived__size_3_01_t_00_01void__if__t_3_07_t_1_1max__der728deceb0d3c42387b62a9cae41666e5}{kblib\+::detail\+\_\+poly\+::extract\+\_\+derived\+\_\+size$<$ T, void\+\_\+if\+\_\+t$<$(\+T\+::max\+\_\+derived\+\_\+size $>$ sizeof(\+T))$>$ $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1default__copy}{kblib\+::default\+\_\+copy$<$ Obj, copyable $>$}}
\begin{DoxyCompactList}\small\item\em Implements type erasure for copy construction. \end{DoxyCompactList}\item 
struct \mbox{\hyperlink{structkblib_1_1default__copy_3_01_obj_00_01false_01_4}{kblib\+::default\+\_\+copy$<$ Obj, false $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1clone__copy}{kblib\+::clone\+\_\+copy$<$ Obj $>$}}
\begin{DoxyCompactList}\small\item\em Implements copy construction using a virtual clone method. This type is provided mostly as an example. \end{DoxyCompactList}\item 
struct \mbox{\hyperlink{structkblib_1_1default__move}{kblib\+::default\+\_\+move$<$ Obj, movable, nothrow, copyable $>$}}
\begin{DoxyCompactList}\small\item\em Implements type erasure for move construction. \end{DoxyCompactList}\item 
struct \mbox{\hyperlink{structkblib_1_1default__move_3_01_obj_00_01false_00_01nothrow_00_01false_01_4}{kblib\+::default\+\_\+move$<$ Obj, false, nothrow, false $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1default__move_3_01_obj_00_01false_00_01nothrow_00_01true_01_4}{kblib\+::default\+\_\+move$<$ Obj, false, nothrow, true $>$}}
\item 
struct \mbox{\hyperlink{structkblib_1_1default__destroy}{kblib\+::default\+\_\+destroy$<$ Obj $>$}}
\begin{DoxyCompactList}\small\item\em Uses the class\textquotesingle{}s virtual destructor. \end{DoxyCompactList}\item 
struct \mbox{\hyperlink{structkblib_1_1poly__obj__traits}{kblib\+::poly\+\_\+obj\+\_\+traits$<$ Obj, CType $>$}}
\begin{DoxyCompactList}\small\item\em \mbox{\hyperlink{structkblib_1_1poly__obj__traits}{poly\+\_\+obj\+\_\+traits}} is a traits class template which abstracts the allowed operations on a polymorphic type hierarchy. Any operation allowed by the traits must be usable for the entire hierarchy, not just the base class. \end{DoxyCompactList}\item 
class \mbox{\hyperlink{classkblib_1_1poly__obj}{kblib\+::poly\+\_\+obj$<$ Obj, Capacity, Traits $>$}}
\begin{DoxyCompactList}\small\item\em Inline polymorphic object. Generally mimics the interfaces of std\+::optional and std\+::variant. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Namespaces}
\begin{DoxyCompactItemize}
\item 
namespace \mbox{\hyperlink{namespacekblib}{kblib}}
\begin{DoxyCompactList}\small\item\em The main namespace in which all entities from kblib are defined. \end{DoxyCompactList}\item 
namespace \mbox{\hyperlink{namespacekblib_1_1detail__poly}{kblib\+::detail\+\_\+poly}}
\begin{DoxyCompactList}\small\item\em Implementation details for \mbox{\hyperlink{classkblib_1_1poly__obj}{poly\+\_\+obj}}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$typename Obj $>$ }\\using \mbox{\hyperlink{namespacekblib_a5695499e50b8ae6a0308bd845774728f}{kblib\+::move\+\_\+only\+\_\+traits}} = poly\+\_\+obj\+\_\+traits$<$ Obj, construct\+\_\+type\+::move $>$
\item 
{\footnotesize template$<$typename Obj $>$ }\\using \mbox{\hyperlink{namespacekblib_a1f329c91b6941e2cc765d59100b34749}{kblib\+::no\+\_\+move\+\_\+traits}} = poly\+\_\+obj\+\_\+traits$<$ Obj, construct\+\_\+type\+::none $>$
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum class \mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7a}{kblib\+::construct\+\_\+type}} \+: unsigned \{ \newline
\mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7aa334c4a4c42fdb79d7ebc3e73b517e6f8}{kblib\+::none}} = 0
, \mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7aa849f12a705c6dbc3ff5da992d47a9982}{kblib\+::copy\+\_\+only}} = 1
, \mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7aa3734a903022249b3010be1897042568e}{kblib\+::move}} = 2
, \mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7aaf6cb3e816496528d4187db53bc66567f}{kblib\+::both}} = 3
, \newline
\mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7aa04d3c750404e3d492d5d7d920189aa52}{kblib\+::throw\+\_\+move}} = 4
, \mbox{\hyperlink{namespacekblib_a2cc6d0e618d41f45deaaa5c6c357ed7aab009e0a1fa84b4e6e58f4ea7acba9712}{kblib\+::both\+\_\+throw}} = 5
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
constexpr auto \mbox{\hyperlink{namespacekblib_a5027ae40714e0bac3fbc7498f9875783}{kblib\+::operator$\vert$}} (construct\+\_\+type l, construct\+\_\+type r) noexcept -\/$>$ construct\+\_\+type
\item 
constexpr auto \mbox{\hyperlink{namespacekblib_abb6b875ecf3a38a03dcd0b15aca7a0ea}{kblib\+::operator\&}} (construct\+\_\+type l, construct\+\_\+type r) noexcept -\/$>$ construct\+\_\+type
\item 
constexpr auto \mbox{\hyperlink{namespacekblib_ae2779c90b5c731d209e9cc1f555a18de}{kblib\+::operator$\ast$}} (construct\+\_\+type l, bool r) noexcept -\/$>$ construct\+\_\+type
\item 
constexpr auto \mbox{\hyperlink{namespacekblib_1_1detail__poly_aa9dd6842a655495099bc36a29c947f3c}{kblib\+::detail\+\_\+poly\+::copyable}} (construct\+\_\+type type) noexcept -\/$>$ bool
\item 
constexpr auto \mbox{\hyperlink{namespacekblib_1_1detail__poly_aa3f1e557e58498f440cfb3a47edc8e69}{kblib\+::detail\+\_\+poly\+::movable}} (construct\+\_\+type type) noexcept -\/$>$ bool
\item 
constexpr auto \mbox{\hyperlink{namespacekblib_1_1detail__poly_ab9643d14f3057466208cd3c874114552}{kblib\+::detail\+\_\+poly\+::nothrow\+\_\+movable}} (construct\+\_\+type type) noexcept -\/$>$ bool
\item 
constexpr auto \mbox{\hyperlink{namespacekblib_1_1detail__poly_a2b36368b4dc8ff5498b7ae45839e47c5}{kblib\+::detail\+\_\+poly\+::make\+\_\+ctype}} (bool copyable, bool movable, bool nothrow\+\_\+movable) -\/$>$ construct\+\_\+type
\item 
{\footnotesize template$<$typename T , typename Traits $>$ }\\auto \mbox{\hyperlink{namespacekblib_1_1detail__poly_ae72ac6a24753c923d2db4b7559718bec}{kblib\+::detail\+\_\+poly\+::make\+\_\+ops\+\_\+t}} () noexcept -\/$>$ erased\+\_\+construct$<$ Traits $>$
\item 
{\footnotesize template$<$typename T $>$ }\\auto \mbox{\hyperlink{namespacekblib_afc76eb7c2cd74d00487dcfcf9f326c53}{kblib\+::noop}} (void $\ast$, const T $\ast$) -\/$>$ T $\ast$
\begin{DoxyCompactList}\small\item\em Does nothing; matches the copy construction signature. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename T , bool nothrow$>$ }\\auto \mbox{\hyperlink{namespacekblib_a26ab0d2883ebc03dffa0dabedfc7d906}{kblib\+::noop}} (void $\ast$, T $\ast$) noexcept(nothrow) -\/$>$ T $\ast$
\begin{DoxyCompactList}\small\item\em Does nothing; matches the move construction signature. \end{DoxyCompactList}\item 
{\footnotesize template$<$bool warn$>$ }\\constexpr auto \mbox{\hyperlink{namespacekblib_a377adf58727d546906018e9e2675b98c}{kblib\+::poly\+\_\+warn\+\_\+if}} () -\/$>$ std\+::nullptr\+\_\+t
\item 
template$<$$>$ constexpr auto \mbox{\hyperlink{namespacekblib_a500de2a9e580338a753636936fd7d533}{kblib\+::poly\+\_\+warn\+\_\+if$<$ true $>$}} () -\/$>$ std\+::nullptr\+\_\+t
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$typename T $>$ }\\constexpr construct\+\_\+type \mbox{\hyperlink{namespacekblib_1_1detail__poly_a61756f447c8151e8a8497341f0109885}{kblib\+::detail\+\_\+poly\+::construct\+\_\+traits}}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Provides poly\+\_\+obj, which enables polymorphism to be used without unnecessary per-\/object dynamic allocations. 

\begin{DoxyAuthor}{Author}
killerbee 
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
2019-\/2021 
\end{DoxyDate}
\begin{DoxyCopyright}{Copyright}
GNU General Public Licence v3.\+0 
\end{DoxyCopyright}


Definition in file \mbox{\hyperlink{poly__obj_8h_source}{poly\+\_\+obj.\+h}}.

