Gromacs  2023.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
pointers.h File Reference
#include <type_traits>
#include <utility>
#include "gromacs/utility/gmxassert.h"
+ Include dependency graph for pointers.h:
+ This graph shows which files directly or indirectly include this file:

Description

Provides ported functions/classes from gsl/pointers.

Adapted from the Guidelines Support Library v2.0.0. at https://github.com/Microsoft/GSL

Author
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Classes

class  gmx::compat::not_null< T >
 Restricts a pointer or smart pointer to only hold non-null values. More...
 

Macros

#define Expects(cond)   GMX_ASSERT((cond), "Precondition violation")
 Contract-assurance macros that work like a simple version of the GSL ones.
 
#define Ensures(cond)   GMX_ASSERT((cond), "Postcondition violation")
 

Functions

template<class T >
not_null< T > gmx::compat::make_not_null (T &&t)
 Convenience function for making not_null pointers from plain pointers.
 
template<class T >
not_null< typename T::pointer > gmx::compat::make_not_null (T &t)
 Convenience function for making not_null pointers from smart pointers.
 
template<class T , class U >
auto gmx::compat::operator== (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()==rhs.get())
 Operators to compare not_null pointers.
 
template<class T , class U >
auto gmx::compat::operator!= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()!=rhs.get())
 
template<class T , class U >
auto gmx::compat::operator< (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()< rhs.get())
 
template<class T , class U >
auto gmx::compat::operator<= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()<=rhs.get())
 
template<class T , class U >
auto gmx::compat::operator> (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get() > rhs.get())
 
template<class T , class U >
auto gmx::compat::operator>= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get() >=rhs.get())
 
template<class T , class U >
std::ptrdiff_t gmx::compat::operator- (const not_null< T > &, const not_null< U > &)=delete
 Deleted unwanted arithmetic operators.
 
template<class T >
not_null< T > gmx::compat::operator- (const not_null< T > &, std::ptrdiff_t)=delete
 
template<class T >
not_null< T > gmx::compat::operator+ (const not_null< T > &, std::ptrdiff_t)=delete
 
template<class T >
not_null< T > gmx::compat::operator+ (std::ptrdiff_t, const not_null< T > &)=delete