\doxysection{type\+\_\+traits.\+hpp}
\hypertarget{type__traits_8hpp_source}{}\label{type__traits_8hpp_source}\index{ginkgo/core/base/type\_traits.hpp@{ginkgo/core/base/type\_traits.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 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\_TYPE\_TRAITS\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_BASE\_TYPE\_TRAITS\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ <type\_traits>}}
\DoxyCodeLine{00009\ }
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/lin\_op.hpp>}}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00013\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type>}
\DoxyCodeLine{00017\ \textcolor{keyword}{constexpr}\ \textcolor{keywordtype}{bool}\ is\_ginkgo\_linop\ =\ std::is\_base\_of\_v<LinOp,\ Type>;}
\DoxyCodeLine{00018\ }
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{comment}{//\ helper\ to\ get\ factory\ type\ of\ concrete\ type\ or\ LinOp}}
\DoxyCodeLine{00021\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type>}
\DoxyCodeLine{00022\ \textcolor{keyword}{struct\ }factory\_type\_impl\ \{}
\DoxyCodeLine{00023\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ \textcolor{keyword}{typename}\ Type::Factory;}
\DoxyCodeLine{00024\ \};}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00026\ \textcolor{comment}{//\ It\ requires\ LinOp\ to\ be\ complete\ type}}
\DoxyCodeLine{00027\ \textcolor{keyword}{template}\ <>}
\DoxyCodeLine{00028\ \textcolor{keyword}{struct\ }factory\_type\_impl<LinOp>\ \{}
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ LinOpFactory;}
\DoxyCodeLine{00030\ \};}
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type>}
\DoxyCodeLine{00034\ \textcolor{keyword}{using\ }factory\_type\ =\ \textcolor{keyword}{typename}\ factory\_type\_impl<Type>::type;}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{comment}{//\ helper\ for\ handle\ the\ transposed\ type\ of\ concrete\ type\ and\ LinOp}}
\DoxyCodeLine{00038\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type,\ \textcolor{keyword}{typename}\ =\ \textcolor{keywordtype}{void}>}
\DoxyCodeLine{00039\ \textcolor{keyword}{struct\ }transposed\_type\_impl\ \{}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ \textcolor{keyword}{typename}\ Type::transposed\_type;}
\DoxyCodeLine{00041\ \};}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ \textcolor{comment}{//\ It\ requires\ LinOp\ to\ be\ complete\ type}}
\DoxyCodeLine{00044\ \textcolor{keyword}{template}\ <>}
\DoxyCodeLine{00045\ \textcolor{keyword}{struct\ }transposed\_type\_impl<LinOp,\ void>\ \{}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ LinOp;}
\DoxyCodeLine{00047\ \};}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ \textcolor{comment}{//\ return\ the\ same\ type\ when\ Type\ is\ the\ precision\ format.}}
\DoxyCodeLine{00050\ \textcolor{comment}{//\ it\ is\ used\ in\ ILU.}}
\DoxyCodeLine{00051\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type>}
\DoxyCodeLine{00052\ \textcolor{keyword}{struct\ }transposed\_type\_impl<Type,\ std::enable\_if\_t<!is\_ginkgo\_linop<Type>>>\ \{}
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ Type;}
\DoxyCodeLine{00054\ \};}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type>}
\DoxyCodeLine{00058\ \textcolor{keyword}{using\ }transposed\_type\ =\ \textcolor{keyword}{typename}\ transposed\_type\_impl<Type>::type;}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00060\ }
\DoxyCodeLine{00061\ \textcolor{comment}{//\ helper\ to\ get\ value\_type\ of\ concrete\ type\ or\ void\ for\ LinOp}}
\DoxyCodeLine{00062\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type,\ \textcolor{keyword}{typename}\ =\ \textcolor{keywordtype}{void}>}
\DoxyCodeLine{00063\ \textcolor{keyword}{struct\ }get\_value\_type\_impl\ \{}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ \textcolor{keyword}{typename}\ Type::value\_type;}
\DoxyCodeLine{00065\ \};}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ \textcolor{comment}{//\ We\ need\ to\ use\ SFINAE\ not\ conditional\_t\ because\ both\ type\ needs\ to\ be}}
\DoxyCodeLine{00068\ \textcolor{comment}{//\ valid\ in\ conditional\_t}}
\DoxyCodeLine{00069\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type>}
\DoxyCodeLine{00070\ \textcolor{keyword}{struct\ }get\_value\_type\_impl<Type,\ std::enable\_if\_t<!is\_ginkgo\_linop<Type>>>\ \{}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keyword}{using\ }type\ =\ Type;}
\DoxyCodeLine{00072\ \};}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ Type>}
\DoxyCodeLine{00076\ \textcolor{keyword}{using\ }get\_value\_type\ =\ \textcolor{keyword}{typename}\ get\_value\_type\_impl<Type>::type;}
\DoxyCodeLine{00077\ }
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00079\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00080\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_BASE\_TYPE\_TRAITS\_HPP\_}}

\end{DoxyCode}
