Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Classes | Functions
gmx::compat Namespace Reference

Description

Compatibility aliases for standard library features.

Provide consistent naming for standard library features that must be back-ported on some platforms. gmx::compat::some_feature may map to back-ported code or to a feature provided by the STL available on a given build platform, but by including the compatibility header and using the gmx::compat namespace, forward and backward compatible code is cleaner and clearer. In the future, when a feature is determined to be provided by the system on all supported platforms, references to gmx::compat::some_feature can be replaced, e.g. with std::some_feature, and gmx::compat::some_feature deprecated.

Since compatibility headers are likely to be included by other headers, there is a risk of ambiguity if code in the gmx namespace refers to an unqualified name in the std namespace. To reduce ambiguity, symbol names from gmx::compat should not be imported into scopes that are shared between multiple translation units (e.g. via using statements in header files).

Namespaces

 anonymous_namespace{pointers.cpp}
 

Classes

class  not_null
 Restricts a pointer or smart pointer to only hold non-null values. More...
 

Functions

template<class T >
not_null< T > make_not_null (T &&t)
 Convenience function for making not_null pointers from plain pointers.
 
template<class T >
not_null< typename T::pointer > make_not_null (T &t)
 Convenience function for making not_null pointers from smart pointers.
 
template<class T >
constexpr const T & as_const (T &t) noexcept
 Forms lvalue reference to const type of t.
 
template<class T , class U >
auto 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 operator!= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()!=rhs.get())
 
template<class T , class U >
auto operator< (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()< rhs.get())
 
template<class T , class U >
auto operator<= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get()<=rhs.get())
 
template<class T , class U >
auto operator> (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get() > rhs.get())
 
template<class T , class U >
auto operator>= (const not_null< T > &lhs, const not_null< U > &rhs) -> decltype(lhs.get() >=rhs.get())
 
template<class T , class U >
std::ptrdiff_t operator- (const not_null< T > &, const not_null< U > &)=delete
 Deleted unwanted arithmetic operators.
 
template<class T >
not_null< T > operator- (const not_null< T > &, std::ptrdiff_t)=delete
 
template<class T >
not_null< T > operator+ (const not_null< T > &, std::ptrdiff_t)=delete
 
template<class T >
not_null< T > operator+ (std::ptrdiff_t, const not_null< T > &)=delete