Reference documentation for deal.II version 9.5.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
PointerComparison Struct Reference

#include <deal.II/base/template_constraints.h>

Static Public Member Functions

template<typename T >
static bool equal (const T *p1, const T *p2)
 
template<typename T , typename U >
static bool equal (const T *, const U *)
 

Detailed Description

A class to perform comparisons of arbitrary pointers for equality. In some circumstances, one would like to make sure that two arguments to a function are not the same object. One would, in this case, make sure that their addresses are not the same. However, sometimes the types of these two arguments may be template types, and they may be the same type or not. In this case, a simple comparison as in &object1 != &object2 does only work if the types of the two objects are equal, but the compiler will barf if they are not. However, in the latter case, since the types of the two objects are different, we can be sure that the two objects cannot be the same.

This class implements a comparison function that always returns false if the types of its two arguments are different, and returns p1 == p2 otherwise.

Definition at line 382 of file template_constraints.h.

Member Function Documentation

◆ equal() [1/2]

template<typename T >
static bool PointerComparison::equal ( const T *  p1,
const T *  p2 
)
inlinestatic

Comparison function for pointers of the same type. Returns true if the two pointers are equal.

Definition at line 390 of file template_constraints.h.

◆ equal() [2/2]

template<typename T , typename U >
static bool PointerComparison::equal ( const T *  ,
const U *   
)
inlinestatic

Comparison function for pointers of different types. The C++ language does not allow comparing these pointers using operator==. However, since the two pointers have different types, we know that they can't be the same, so we always return false.

Definition at line 404 of file template_constraints.h.


The documentation for this struct was generated from the following file: