\hypertarget{classBaseAndDerived}{
\section{BaseAndDerived$<$ B, D $>$ Class Template Reference}
\label{classBaseAndDerived}\index{BaseAndDerived@{BaseAndDerived}}
}


Class to determine if two types are base and derived.  




{\ttfamily \#include $<$minitraits.hh$>$}

\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structBaseAndDerived_1_1X}{X}
\end{DoxyCompactItemize}
\subsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classBaseAndDerived_ada1165719ac05ea7121784f281352e82}{
static const bool {\bfseries True} = ( sizeof(X::f((D$\ast$)0)) == sizeof(X::f((B$\ast$)0)) )}
\label{classBaseAndDerived_ada1165719ac05ea7121784f281352e82}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename B, typename D$>$ class BaseAndDerived$<$ B, D $>$}

Class to determine if two types are base and derived. This class tests whether a pointer for type B is useable as pointer to type D. Typically, this implies that B is a base for D. It may also imply that B is void, or B and D are \hyperlink{protocolthe-p}{the} same type.

How this works? Overloaded definition of function X::f(). The first of which takes a const B$\ast$ pointer as an argument and returns are char. The second of which takes a ... and returns a double. sizeof is used to determine \hyperlink{protocolthe-p}{the} size of \hyperlink{protocolthe-p}{the} return type that would used if \hyperlink{protocolthe-p}{the} code were executed. Thus, if B and D are compatible pointer types then sizeof(X::f()) for both of them is sizeof(char). 

The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/minitraits.hh\end{DoxyCompactItemize}
