\doxysection{utils\+\_\+helper.\+hpp}
\hypertarget{utils__helper_8hpp_source}{}\label{utils__helper_8hpp_source}\index{ginkgo/core/base/utils\_helper.hpp@{ginkgo/core/base/utils\_helper.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2025\ The\ Ginkgo\ authors}}
\DoxyCodeLine{00002\ \textcolor{comment}{//}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ SPDX-\/License-\/Identifier:\ BSD-\/3-\/Clause}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#ifndef\ GKO\_PUBLIC\_CORE\_BASE\_UTILS\_HELPER\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_BASE\_UTILS\_HELPER\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <functional>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <type\_traits>}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/exception.hpp>}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/name\_demangling.hpp>}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/types.hpp>}}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#ifndef\ NDEBUG}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#include\ <cstdio>}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ NDEBUG}}
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ }
\DoxyCodeLine{00023\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1Executor}{Executor}};}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00040\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00041\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param}}\ \{}
\DoxyCodeLine{00042\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00044\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param}}(T*\ ptr)\ :\ ptr\_\{ptr\}\ \{\}}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ U,}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::enable\_if\_t<std::is\_base\_of<T,\ U>::value>*\ =\ \textcolor{keyword}{nullptr}>}
\DoxyCodeLine{00049\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param_a63e69e923e5132252dd542e497e6141d}{ptr\_param}}(\textcolor{keyword}{const}\ std::shared\_ptr<U>\&\ ptr)\ :\ \doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param}}\{ptr.\doxymbox{\hyperlink{classgko_1_1ptr__param_ad1245c2636fdba26d3a3fab9fec5e068}{get}}()\}}
\DoxyCodeLine{00050\ \ \ \ \ \{\}}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ U,\ \textcolor{keyword}{typename}\ Deleter,}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::enable\_if\_t<std::is\_base\_of<T,\ U>::value>*\ =\ \textcolor{keyword}{nullptr}>}
\DoxyCodeLine{00055\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param_a5edbc2e180229108b91d083a7a3aa017}{ptr\_param}}(\textcolor{keyword}{const}\ std::unique\_ptr<U,\ Deleter>\&\ ptr)\ :\ \doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param}}\{ptr.\doxymbox{\hyperlink{classgko_1_1ptr__param_ad1245c2636fdba26d3a3fab9fec5e068}{get}}()\}}
\DoxyCodeLine{00056\ \ \ \ \ \{\}}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ U,}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::enable\_if\_t<std::is\_base\_of<T,\ U>::value>*\ =\ \textcolor{keyword}{nullptr}>}
\DoxyCodeLine{00061\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param_af32213ae7b8ded4b855c0a1f5168e97c}{ptr\_param}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param<U>}}\&\ ptr)\ :\ \doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param}}\{ptr.\doxymbox{\hyperlink{classgko_1_1ptr__param_ad1245c2636fdba26d3a3fab9fec5e068}{get}}()\}}
\DoxyCodeLine{00062\ \ \ \ \ \{\}}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param}}\&)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param_aa103a3e9e9064a2ba17eb019613d4728}{ptr\_param}}(\doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param}}\&\&)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00069\ \ \ \ \ T\&\ \doxymbox{\hyperlink{classgko_1_1ptr__param_a195e6ac4608338a9eceb934a90e249df}{operator*}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ *ptr\_;\ \}}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00072\ \ \ \ \ T*\ \doxymbox{\hyperlink{classgko_1_1ptr__param_adf0aa137dc65b34a4206cd772d51792d}{operator-\/>}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ ptr\_;\ \}}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00075\ \ \ \ \ T*\ \doxymbox{\hyperlink{classgko_1_1ptr__param_ad1245c2636fdba26d3a3fab9fec5e068}{get}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ ptr\_;\ \}}
\DoxyCodeLine{00076\ }
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keyword}{explicit}\ \textcolor{keyword}{operator}\ bool()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ ptr\_;\ \}}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param}}\&\ operator=(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param}}\&)\ =\ \textcolor{keyword}{delete};}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \ \ \ \ \doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param}}\&\ operator=(\doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param}}\&\&)\ =\ \textcolor{keyword}{delete};}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00085\ \ \ \ \ T*\ ptr\_;}
\DoxyCodeLine{00086\ \};}
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00089\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00093\ \textcolor{keyword}{using\ }pointee\ =}
\DoxyCodeLine{00094\ \ \ \ \ std::remove\_reference\_t<\textcolor{keyword}{decltype}(*std::declval<std::decay\_t<T>>())>;}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00096\ }
\DoxyCodeLine{00097\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ =\ \textcolor{keywordtype}{void}>}
\DoxyCodeLine{00098\ \textcolor{keyword}{struct\ }is\_cloneable\_impl\ :\ std::false\_type\ \{\};}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00101\ \textcolor{keyword}{struct\ }is\_cloneable\_impl<T,\ std::\doxymbox{\hyperlink{namespacegko_1_1xstd_a2d53b45325a9d6c46906d80caf180869}{void\_t}}<decltype(std::declval<T>().clone())>>}
\DoxyCodeLine{00102\ \ \ \ \ :\ std::true\_type\ \{\};}
\DoxyCodeLine{00103\ }
\DoxyCodeLine{00104\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00105\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_cloneable()}
\DoxyCodeLine{00106\ \{}
\DoxyCodeLine{00107\ \ \ \ \ \textcolor{keywordflow}{return}\ is\_cloneable\_impl<std::decay\_t<T>>::value;}
\DoxyCodeLine{00108\ \}}
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00111\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ =\ \textcolor{keywordtype}{void}>}
\DoxyCodeLine{00112\ \textcolor{keyword}{struct\ }is\_cloneable\_to\_impl\ :\ std::false\_type\ \{\};}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00114\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00115\ \textcolor{keyword}{struct\ }is\_cloneable\_to\_impl<}
\DoxyCodeLine{00116\ \ \ \ \ T,\ std::\doxymbox{\hyperlink{namespacegko_1_1xstd_a2d53b45325a9d6c46906d80caf180869}{void\_t}}<decltype(std::declval<T>().clone(}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \ \ \ std::declval<std::shared\_ptr<const\ Executor>>()))>>}
\DoxyCodeLine{00118\ \ \ \ \ :\ std::true\_type\ \{\};}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00121\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_cloneable\_to()}
\DoxyCodeLine{00122\ \{}
\DoxyCodeLine{00123\ \ \ \ \ \textcolor{keywordflow}{return}\ is\_cloneable\_to\_impl<std::decay\_t<T>>::value;}
\DoxyCodeLine{00124\ \}}
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00127\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00128\ \textcolor{keyword}{struct\ }have\_ownership\_impl\ :\ std::false\_type\ \{\};}
\DoxyCodeLine{00129\ }
\DoxyCodeLine{00130\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ Deleter>}
\DoxyCodeLine{00131\ \textcolor{keyword}{struct\ }have\_ownership\_impl<std::unique\_ptr<T,\ Deleter>>\ :\ std::true\_type\ \{\};}
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00134\ \textcolor{keyword}{struct\ }have\_ownership\_impl<std::shared\_ptr<T>>\ :\ std::true\_type\ \{\};}
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00136\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00137\ \textcolor{keyword}{using\ }have\_ownership\_s\ =\ have\_ownership\_impl<std::decay\_t<T>>;}
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00139\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00140\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ have\_ownership()}
\DoxyCodeLine{00141\ \{}
\DoxyCodeLine{00142\ \ \ \ \ \textcolor{keywordflow}{return}\ have\_ownership\_s<T>::value;}
\DoxyCodeLine{00143\ \}}
\DoxyCodeLine{00144\ }
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Po\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00147\ \textcolor{keyword}{using\ }cloned\_type\ =}
\DoxyCodeLine{00148\ \ \ \ \ std::unique\_ptr<typename\ std::remove\_cv<pointee<Pointer>>::type>;}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00151\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Po\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00152\ \textcolor{keyword}{using\ }shared\_type\ =\ std::shared\_ptr<pointee<Pointer>>;}
\DoxyCodeLine{00153\ }
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00155\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00156\ }
\DoxyCodeLine{00157\ }
\DoxyCodeLine{00172\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Po\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00173\ \textcolor{keyword}{inline}\ detail::cloned\_type<Pointer>\ \doxymbox{\hyperlink{namespacegko_aa194e34282452493231ca7b01ffb5e64}{clone}}(\textcolor{keyword}{const}\ Pointer\&\ p)}
\DoxyCodeLine{00174\ \{}
\DoxyCodeLine{00175\ \ \ \ \ \textcolor{keyword}{static\_assert}(detail::is\_cloneable<detail::pointee<Pointer>>(),}
\DoxyCodeLine{00176\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Object\ is\ not\ cloneable"{}});}
\DoxyCodeLine{00177\ \ \ \ \ \textcolor{keywordflow}{return}\ detail::cloned\_type<Pointer>(}
\DoxyCodeLine{00178\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static\_cast<}typename\ std::remove\_cv<detail::pointee<Pointer>\textcolor{keyword}{>}::type*>(}
\DoxyCodeLine{00179\ \ \ \ \ \ \ \ \ \ \ \ \ p-\/>clone().release()));}
\DoxyCodeLine{00180\ \}}
\DoxyCodeLine{00181\ }
\DoxyCodeLine{00182\ }
\DoxyCodeLine{00198\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Po\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00199\ \textcolor{keyword}{inline}\ detail::cloned\_type<Pointer>\ \doxymbox{\hyperlink{namespacegko_aa194e34282452493231ca7b01ffb5e64}{clone}}(std::shared\_ptr<const\ Executor>\ exec,}
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ Pointer\&\ p)}
\DoxyCodeLine{00201\ \{}
\DoxyCodeLine{00202\ \ \ \ \ \textcolor{keyword}{static\_assert}(detail::is\_cloneable\_to<detail::pointee<Pointer>>(),}
\DoxyCodeLine{00203\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}Object\ is\ not\ cloneable"{}});}
\DoxyCodeLine{00204\ \ \ \ \ \textcolor{keywordflow}{return}\ detail::cloned\_type<Pointer>(}
\DoxyCodeLine{00205\ \ \ \ \ \ \ \ \ \textcolor{keyword}{static\_cast<}typename\ std::remove\_cv<detail::pointee<Pointer>\textcolor{keyword}{>}::type*>(}
\DoxyCodeLine{00206\ \ \ \ \ \ \ \ \ \ \ \ \ p-\/>clone(std::move(exec)).release()));}
\DoxyCodeLine{00207\ \}}
\DoxyCodeLine{00208\ }
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00223\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ OwningPo\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00224\ \textcolor{keyword}{inline}\ detail::shared\_type<OwningPointer>\ \doxymbox{\hyperlink{namespacegko_ae99fdd8bfa5ac694adcb7297d432967e}{share}}(OwningPointer\&\&\ p)}
\DoxyCodeLine{00225\ \{}
\DoxyCodeLine{00226\ \ \ \ \ \textcolor{keyword}{static\_assert}(detail::have\_ownership<OwningPointer>(),}
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}OwningPointer\ does\ not\ have\ ownership\ of\ the\ object"{}});}
\DoxyCodeLine{00228\ \ \ \ \ \textcolor{keyword}{static\_assert}(std::is\_rvalue\_reference<\textcolor{keyword}{decltype}(p)>::value,}
\DoxyCodeLine{00229\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}p\ must\ be\ an\ rvalue\ for\ this\ function\ to\ work"{}});}
\DoxyCodeLine{00230\ \ \ \ \ \textcolor{keywordflow}{return}\ detail::shared\_type<OwningPointer>(std::move(p));}
\DoxyCodeLine{00231\ \}}
\DoxyCodeLine{00232\ }
\DoxyCodeLine{00233\ }
\DoxyCodeLine{00246\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ OwningPo\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00247\ \textcolor{keyword}{inline}\ \textcolor{keyword}{typename}\ std::remove\_reference<OwningPointer>::type\&\&\ \doxymbox{\hyperlink{namespacegko_abc3b2c363d6eb3d9837a6d9efa589844}{give}}(}
\DoxyCodeLine{00248\ \ \ \ \ OwningPointer\&\&\ p)}
\DoxyCodeLine{00249\ \{}
\DoxyCodeLine{00250\ \ \ \ \ \textcolor{keyword}{static\_assert}(detail::have\_ownership<OwningPointer>(),}
\DoxyCodeLine{00251\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{stringliteral}{"{}OwningPointer\ does\ not\ have\ ownership\ of\ the\ object"{}});}
\DoxyCodeLine{00252\ \ \ \ \ \textcolor{keywordflow}{return}\ std::move(p);}
\DoxyCodeLine{00253\ \}}
\DoxyCodeLine{00254\ }
\DoxyCodeLine{00255\ }
\DoxyCodeLine{00266\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Po\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00267\ GKO\_DEPRECATED(\textcolor{stringliteral}{"{}no\ longer\ necessary,\ just\ pass\ the\ object\ without\ lend"{}})}
\DoxyCodeLine{00268\ inline\ typename\ \doxymbox{\hyperlink{namespacestd}{std}}::enable\_if<detail::have\_ownership\_s<Pointer>::value,}
\DoxyCodeLine{00269\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ detail::pointee<Pointer>*>::type}
\DoxyCodeLine{00270\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_aa011422ea11684b8b3121058cd6f8933}{lend}}(const\ Pointer\&\ p)}
\DoxyCodeLine{00271\ \{}
\DoxyCodeLine{00272\ \ \ \ \ \textcolor{keywordflow}{return}\ p.get();}
\DoxyCodeLine{00273\ \}}
\DoxyCodeLine{00274\ }
\DoxyCodeLine{00285\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Po\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00286\ GKO\_DEPRECATED(\textcolor{stringliteral}{"{}no\ longer\ necessary,\ just\ pass\ the\ object\ without\ lend"{}})}
\DoxyCodeLine{00287\ inline\ typename\ \doxymbox{\hyperlink{namespacestd}{std}}::enable\_if<!detail::have\_ownership\_s<Pointer>::value,}
\DoxyCodeLine{00288\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ detail::pointee<Pointer>*>::type}
\DoxyCodeLine{00289\ \ \ \ \ \doxymbox{\hyperlink{namespacegko_aa011422ea11684b8b3121058cd6f8933}{lend}}(const\ Pointer\&\ p)}
\DoxyCodeLine{00290\ \{}
\DoxyCodeLine{00291\ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00292\ \}}
\DoxyCodeLine{00293\ }
\DoxyCodeLine{00294\ }
\DoxyCodeLine{00306\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ U>}
\DoxyCodeLine{00307\ \textcolor{keyword}{inline}\ std::decay\_t<T>*\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as}}(U*\ obj)}
\DoxyCodeLine{00308\ \{}
\DoxyCodeLine{00309\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{auto}\ p\ =\ \textcolor{keyword}{dynamic\_cast<}std::decay\_t<T>*\textcolor{keyword}{>}(obj))\ \{}
\DoxyCodeLine{00310\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00311\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00312\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ \doxymbox{\hyperlink{classgko_1_1NotSupported}{NotSupported}}(\_\_FILE\_\_,\ \_\_LINE\_\_,}
\DoxyCodeLine{00313\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::string\{\textcolor{stringliteral}{"{}gko::as<"{}}\}\ +}
\DoxyCodeLine{00314\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\_demangling::get\_type\_name(\textcolor{keyword}{typeid}(T))\ +\ \textcolor{stringliteral}{"{}>"{}},}
\DoxyCodeLine{00315\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\_demangling::get\_type\_name(\textcolor{keyword}{typeid}(*obj)));}
\DoxyCodeLine{00316\ \ \ \ \ \}}
\DoxyCodeLine{00317\ \}}
\DoxyCodeLine{00318\ }
\DoxyCodeLine{00332\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ U>}
\DoxyCodeLine{00333\ \textcolor{keyword}{inline}\ \textcolor{keyword}{const}\ std::decay\_t<T>*\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as}}(\textcolor{keyword}{const}\ U*\ obj)}
\DoxyCodeLine{00334\ \{}
\DoxyCodeLine{00335\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{auto}\ p\ =\ \textcolor{keyword}{dynamic\_cast<}\textcolor{keyword}{const\ }std::decay\_t<T>*\textcolor{keyword}{>}(obj))\ \{}
\DoxyCodeLine{00336\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00337\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00338\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ \doxymbox{\hyperlink{classgko_1_1NotSupported}{NotSupported}}(\_\_FILE\_\_,\ \_\_LINE\_\_,}
\DoxyCodeLine{00339\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::string\{\textcolor{stringliteral}{"{}gko::as<"{}}\}\ +}
\DoxyCodeLine{00340\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\_demangling::get\_type\_name(\textcolor{keyword}{typeid}(T))\ +\ \textcolor{stringliteral}{"{}>"{}},}
\DoxyCodeLine{00341\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\_demangling::get\_type\_name(\textcolor{keyword}{typeid}(*obj)));}
\DoxyCodeLine{00342\ \ \ \ \ \}}
\DoxyCodeLine{00343\ \}}
\DoxyCodeLine{00344\ }
\DoxyCodeLine{00345\ }
\DoxyCodeLine{00357\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ U>}
\DoxyCodeLine{00358\ \textcolor{keyword}{inline}\ std::decay\_t<T>*\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as}}(\doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param<U>}}\ obj)}
\DoxyCodeLine{00359\ \{}
\DoxyCodeLine{00360\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as<T>}}(obj.\doxymbox{\hyperlink{classgko_1_1ptr__param_ad1245c2636fdba26d3a3fab9fec5e068}{get}}());}
\DoxyCodeLine{00361\ \}}
\DoxyCodeLine{00362\ }
\DoxyCodeLine{00376\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ U>}
\DoxyCodeLine{00377\ \textcolor{keyword}{inline}\ \textcolor{keyword}{const}\ std::decay\_t<T>*\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as}}(\doxymbox{\hyperlink{classgko_1_1ptr__param}{ptr\_param<const\ U>}}\ obj)}
\DoxyCodeLine{00378\ \{}
\DoxyCodeLine{00379\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as<T>}}(obj.\doxymbox{\hyperlink{classgko_1_1ptr__param_ad1245c2636fdba26d3a3fab9fec5e068}{get}}());}
\DoxyCodeLine{00380\ \}}
\DoxyCodeLine{00381\ }
\DoxyCodeLine{00382\ }
\DoxyCodeLine{00395\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ U>}
\DoxyCodeLine{00396\ \textcolor{keyword}{inline}\ std::unique\_ptr<std::decay\_t<T>>\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as}}(std::unique\_ptr<U>\&\&\ obj)}
\DoxyCodeLine{00397\ \{}
\DoxyCodeLine{00398\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{auto}\ p\ =\ \textcolor{keyword}{dynamic\_cast<}std::decay\_t<T>*\textcolor{keyword}{>}(obj.get()))\ \{}
\DoxyCodeLine{00399\ \ \ \ \ \ \ \ \ obj.release();}
\DoxyCodeLine{00400\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ std::unique\_ptr<std::decay\_t<T>>\{p\};}
\DoxyCodeLine{00401\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00402\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ \doxymbox{\hyperlink{classgko_1_1NotSupported}{NotSupported}}(\_\_FILE\_\_,\ \_\_LINE\_\_,\ \_\_func\_\_,}
\DoxyCodeLine{00403\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\_demangling::get\_type\_name(\textcolor{keyword}{typeid}(*obj)));}
\DoxyCodeLine{00404\ \ \ \ \ \}}
\DoxyCodeLine{00405\ \}}
\DoxyCodeLine{00406\ }
\DoxyCodeLine{00407\ }
\DoxyCodeLine{00419\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ U>}
\DoxyCodeLine{00420\ \textcolor{keyword}{inline}\ std::shared\_ptr<std::decay\_t<T>>\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as}}(std::shared\_ptr<U>\ obj)}
\DoxyCodeLine{00421\ \{}
\DoxyCodeLine{00422\ \ \ \ \ \textcolor{keyword}{auto}\ ptr\ =\ std::dynamic\_pointer\_cast<std::decay\_t<T>>(obj);}
\DoxyCodeLine{00423\ \ \ \ \ \textcolor{keywordflow}{if}\ (ptr)\ \{}
\DoxyCodeLine{00424\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ptr;}
\DoxyCodeLine{00425\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00426\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ \doxymbox{\hyperlink{classgko_1_1NotSupported}{NotSupported}}(\_\_FILE\_\_,\ \_\_LINE\_\_,\ \_\_func\_\_,}
\DoxyCodeLine{00427\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\_demangling::get\_type\_name(\textcolor{keyword}{typeid}(*obj)));}
\DoxyCodeLine{00428\ \ \ \ \ \}}
\DoxyCodeLine{00429\ \}}
\DoxyCodeLine{00430\ }
\DoxyCodeLine{00431\ }
\DoxyCodeLine{00445\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keyword}{typename}\ U>}
\DoxyCodeLine{00446\ \textcolor{keyword}{inline}\ std::shared\_ptr<const\ std::decay\_t<T>>\ \doxymbox{\hyperlink{namespacegko_ae3e355a655feea026a7c46814d37a9c9}{as}}(std::shared\_ptr<const\ U>\ obj)}
\DoxyCodeLine{00447\ \{}
\DoxyCodeLine{00448\ \ \ \ \ \textcolor{keyword}{auto}\ ptr\ =\ std::dynamic\_pointer\_cast<const\ std::decay\_t<T>>(obj);}
\DoxyCodeLine{00449\ \ \ \ \ \textcolor{keywordflow}{if}\ (ptr)\ \{}
\DoxyCodeLine{00450\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ptr;}
\DoxyCodeLine{00451\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00452\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ \doxymbox{\hyperlink{classgko_1_1NotSupported}{NotSupported}}(\_\_FILE\_\_,\ \_\_LINE\_\_,\ \_\_func\_\_,}
\DoxyCodeLine{00453\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name\_demangling::get\_type\_name(\textcolor{keyword}{typeid}(*obj)));}
\DoxyCodeLine{00454\ \ \ \ \ \}}
\DoxyCodeLine{00455\ \}}
\DoxyCodeLine{00456\ }
\DoxyCodeLine{00457\ }
\DoxyCodeLine{00464\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00465\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1null__deleter}{null\_deleter}}\ \{}
\DoxyCodeLine{00466\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00467\ \ \ \ \ \textcolor{keyword}{using\ }pointer\ =\ T*;}
\DoxyCodeLine{00468\ }
\DoxyCodeLine{00474\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1null__deleter_a09fc153e500a30edaa572f2c6cb674ab}{operator()}}(pointer)\ \textcolor{keyword}{const}\ \textcolor{keyword}{noexcept}\ \{\}}
\DoxyCodeLine{00475\ \};}
\DoxyCodeLine{00476\ }
\DoxyCodeLine{00477\ \textcolor{comment}{//\ a\ specialization\ for\ arrays}}
\DoxyCodeLine{00478\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00479\ \textcolor{keyword}{class\ }\doxymbox{\hyperlink{classgko_1_1null__deleter}{null\_deleter}}<T[]>\ \{}
\DoxyCodeLine{00480\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00481\ \ \ \ \ \textcolor{keyword}{using\ }pointer\ =\ T[];}
\DoxyCodeLine{00482\ }
\DoxyCodeLine{00483\ \ \ \ \ \textcolor{keywordtype}{void}\ \doxymbox{\hyperlink{classgko_1_1null__deleter_a09fc153e500a30edaa572f2c6cb674ab}{operator()}}(pointer)\ \textcolor{keyword}{const}\ \textcolor{keyword}{noexcept}\ \{\}}
\DoxyCodeLine{00484\ \};}
\DoxyCodeLine{00485\ }
\DoxyCodeLine{00486\ }
\DoxyCodeLine{00487\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00488\ }
\DoxyCodeLine{00489\ }
\DoxyCodeLine{00490\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_BASE\_UTILS\_HELPER\_HPP\_}}

\end{DoxyCode}
